name | arguments | returns |
__str__ | self | str |
Return an overview description of this object
:return: A string with a description of this object
|
name | arguments | returns |
serialize | self | dict |
Extract and return a dict of relevent data from this object
:return:
|
name | arguments | returns |
get_graph_data | self | dict |
Return a data dictionary with all the relevant visualization info
(typically, to pass to the front-end, for eventual use by the Cytoscape.js library)
:return: A dict with 3 keys - "structure", "color_mapping" and "caption_mapping"
|
name | arguments | returns |
add_node | node_id :Union[int,str], labels="", data=None | None |
Prepare and store the data for 1 node, in a format expected by the visualization front-end
EXAMPLE: {'id': 1, 'name': 'Julian', 'labels': ['PERSON']}
:param node_id: Either an integer or a string to uniquely identify this node in the graph;
it will be used to specify the start/end nodes of edges.
Typically, use either the internal database ID, or some URI
Records with a duplicate node_id are silently disregarded
:param labels: A string, or list of strings, with the node's label(s) used in the graph database;
if not used, pass an empty string
:param data: A dict with all other node data not already specified in any of the other arguments
:return: None
|
name | arguments | returns |
add_edge | from_node :Union[str, int], to_node :Union[str, int],
name :str, edge_id=None, data=None | None |
Prepare and store the data for 1 edge, in a format expected by the visualization front-end.
EXAMPLE: {'name': 'OWNS', 'source': 1, 'target': 2, 'id': 'edge-1'}
Note that 'id', in this context, is whatever we pass to the visualization module for the nodes;
not necessarily related to the internal database ID's
:param from_node: Integer or a string uniquely identify the "id" of the node where the edge originates
:param to_node: Integer or a string uniquely identify the "id" of the node where the edge ends
:param name: Name of the relationship
:param edge_id: (OPTIONAL) If not provided, strings such as "edge-123" are used,
with auto-generated consecutive integers
:param data: A dict with all other node data not already specified in any of the other arguments
:return: None
|
name | arguments | returns |
assign_caption | label :str, caption="name" | None |
Assign and store a mapping from label name to caption (name of field to use on the display)
EXAMPLES: assign_caption(label='PERSON', caption='name')
assign_caption(label='CAR', caption='color')
:param label: The name of a node label
:param caption: The name of the node field to use on the display (by default, "name")
:return: None
|
name | arguments | returns |
assign_color_mapping | label :str, color :str | None |
Assign and store a mapping from label name to color to use for nodes having that label
:param label: The name of a node label
:param color: The name (hex string or standard CSS name) of the color to use on the display
:return: None
|
name | arguments | returns |
prepare_graph | result_dataset :[dict], add_edges=True | [int] |
Given a list of dictionary data about graph-database nodes - for example,
as returned by NeoAccess.get_nodes() - construct and save visualization data for them.
Each dictionary entry is expected to have a key named "internal_id";
if not present, it will be silently ignored.
Though not required, a key named "neo4j_labels" is typically present as well.
:param result_dataset: A list of dictionary data about graph-database nodes
:param add_edges: If True, all existing edges among the displayed nodes
will also be part of the visualization
:return: A list of integers with the internal databased IDs
of all the nodes added to the graph structure
|
name | arguments | returns |
link_node_groups | group1 :[int], group2 :[int] | None |
Search the database for any edges from any of the nodes in the 1st group, to any node in the 2nd group.
Any located edge will be added to the visualization data stored in this object
:param group1: List of integers with the internal databased IDs of the 1st group of nodes
:param group2: List of integers with the internal databased IDs of the 2nd group of nodes
:return: None
|