graphrecords.graphrecord.GraphRecord#
- class GraphRecord[source]#
Bases:
objectA class to manage medical records with node and edge data structures.
Provides methods to create instances from different data formats, manage node and edge attributes, and perform operations like adding or removing nodes and edges.
Methods
__init__()Initializes a GraphRecord instance.
add_edges(edges[, group])Adds edges to the GraphRecord instance from various data formats.
add_edges_pandas(edges[, group])Adds edges to the GraphRecord from one or more Pandas DataFrames.
add_edges_polars(edges[, group])Adds edges to the GraphRecord from one or more Polars DataFrames.
add_edges_to_group(group, edges)Adds one or more edges to a specified group in the GraphRecord.
add_group(group[, nodes, edges])Adds a group to the GraphRecord, optionally with node and edge indices.
add_nodes(nodes[, group])Adds nodes to the GraphRecord from different data formats.
add_nodes_pandas(nodes[, group])Adds nodes to the GraphRecord instance from one or more Pandas DataFrames.
add_nodes_polars(nodes[, group])Adds nodes to the GraphRecord instance from one or more Polars DataFrames.
add_nodes_to_group(group, nodes)Adds one or more nodes to a specified group in the GraphRecord.
builder()Creates a GraphRecordBuilder instance to build a GraphRecord.
clear()Clears all data from the GraphRecord instance.
clone()Clones the GraphRecord instance.
contains_edge(edge)Checks whether a specific edge exists in the GraphRecord.
contains_group(group)Checks whether a specific group exists in the GraphRecord.
contains_node(node)Checks whether a specific node exists in the GraphRecord.
Returns the total number of edges currently managed by the GraphRecord.
edge_endpoints(edge)Retrieves the source and target nodes of the specified edge(s).
edges_connecting(source_node, target_node[, ...])Retrieves the edges connecting the specified source and target nodes.
edges_in_group(group)Retrieves the edge indices associated with the specified group(s).
Freezes the schema.
from_pandas(nodes[, edges])Creates a GraphRecord from Pandas DataFrames of nodes and optionally edges.
from_polars(nodes[, edges])Creates a GraphRecord from Polars DataFrames of nodes and optionally edges.
from_ron(path)Creates a GraphRecord instance from a RON file.
from_tuples(nodes[, edges])Creates a GraphRecord instance from lists of node and edge tuples.
Returns a copy of the GraphRecord's schema.
group(group)Returns the node and edge indices associated with the specified group/s.
Returns the total number of groups currently defined within the GraphRecord.
group_overview(group[, truncate_details])Generates an overview of a specific group in the GraphRecord instance.
groups_of_edge(edge)Retrieves the groups associated with the specified edge(s) in the GraphRecord.
groups_of_node(node)Retrieves the groups associated with the specified node(s) in the GraphRecord.
incoming_edges(node)Lists the incoming edges of the specified node(s) in the GraphRecord.
neighbors(node[, directed])Retrieves the neighbors of the specified node(s) in the GraphRecord.
Returns the total number of nodes currently managed by the GraphRecord.
nodes_in_group(group)Retrieves the node indices associated with the specified group/s.
outgoing_edges(node)Lists the outgoing edges of the specified node(s) in the GraphRecord.
overview([truncate_details])Generates an overview of the GraphRecord instance.
query_edges(query)Retrieves information on the edges from the GraphRecord given the query.
query_nodes(query)Retrieves information on the nodes from the GraphRecord given the query.
remove_edges(edges)Removes edges from the GraphRecord and returns their attributes.
remove_edges_from_group(group, edges)Removes one or more edges from a specified group in the GraphRecord.
remove_groups(groups)Removes one or more groups from the GraphRecord instance.
remove_nodes(nodes)Removes nodes from the GraphRecord and returns their attributes.
remove_nodes_from_group(group, nodes)Removes one or more nodes from a specified group in the GraphRecord.
set_schema(schema)Sets the schema of the GraphRecord instance.
Exports the GraphRecord instance to Pandas DataFrames.
Exports the GraphRecord instance to Polars DataFrames.
to_ron(path)Writes the GraphRecord instance to a RON file.
Unfreezes the schema.
Retrieves the edge indices that are not associated with any group.
Retrieves the node indices that are not associated with any group.
with_schema(schema)Creates a GraphRecord instance with the specified schema.
Attributes
Provides access to edge attributes within the GraphRecord via an indexer.
Lists the edge indices in the GraphRecord instance.
Lists the groups in the GraphRecord instance.
Provides access to node attributes within the GraphRecord via an indexer.
Lists the node indices in the GraphRecord instance.
- __repr__()[source]#
Returns a string representation of the GraphRecord instance.
- Return type:
str- Returns:
str – A string representation of the GraphRecord instance.
- add_edges(edges, group=None)[source]#
Adds edges to the GraphRecord instance from various data formats.
Accepts edge tuple, lists of tuples, DataFrame(s), or EdgeDataFrameInput(s) to add edges. Each tuple must have indices for source and target nodes and a dictionary of attributes. If a DataFrame or list of DataFrames is used, the add_edges_dataframe method is invoked. If PolarsEdgeDataFrameInput(s) are provided, each tuple must include a DataFrame and index columns for source and target nodes. If a group is specified, the edges are added to the group.
- Parameters:
edges (EdgeInput) – Data representing edges in several formats.
group (Optional[Group]) – The name of the group to add the edges to. If not specified, the edges are added to the GraphRecord without a group.
- Return type:
List[int]- Returns:
List[EdgeIndex] – A list of edge indices that were added.
- add_edges_pandas(edges, group=None)[source]#
Adds edges to the GraphRecord from one or more Pandas DataFrames.
This method accepts either a single PandasEdgeDataFrameInput tuple or a list of such tuples, each including a DataFrame and index columns for the source and target nodes. If a group is specified, the edges are added to the group.
- Parameters:
edges (Union[PandasEdgeDataFrameInput, List[PandasEdgeDataFrameInput]]) – A tuple or list of tuples, each including a DataFrame and index columns for source and target nodes.
group (Optional[Group]) – The name of the group to add the edges to. If not specified, the edges are added to the GraphRecord without a group.
- Return type:
List[int]- Returns:
List[EdgeIndex] – A list of the edge indices added.
- add_edges_polars(edges, group=None)[source]#
Adds edges to the GraphRecord from one or more Polars DataFrames.
This method accepts either a single PolarsEdgeDataFrameInput tuple or a list of such tuples, each including a DataFrame and index columns for the source and target nodes. If a group is specified, the edges are added to the group.
- Parameters:
edges (Union[PolarsEdgeDataFrameInput, List[PolarsEdgeDataFrameInput]]) – A tuple or list of tuples, each including a DataFrame and index columns for source and target nodes.
group (Optional[Group]) – The name of the group to add the edges to. If not specified, the edges are added to the GraphRecord without a group.
- Return type:
List[int]- Returns:
List[EdgeIndex] – A list of the edge indices added.
- add_edges_to_group(group, edges)[source]#
Adds one or more edges to a specified group in the GraphRecord.
- Parameters:
group (Group) – The name of the group to add edges to.
edges (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]) – One or more edge indices or an edge query to add to the group.
- Return type:
None- Returns:
None
- add_group(group, nodes=None, edges=None)[source]#
Adds a group to the GraphRecord, optionally with node and edge indices.
If node indices are specified, they are added to the group. If no nodes are specified, the group is created without any nodes.
- Parameters:
group (Group) – The name of the group to add.
nodes (Optional[Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]]) – One or more node indices or a node query to add to the group, optional.
edges (Optional[Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]]) – One or more edge indices or an edge query to add to the group, optional.
- Return type:
None- Returns:
None
- add_nodes(nodes, group=None)[source]#
Adds nodes to the GraphRecord from different data formats.
Accepts a node tuple (single node added), a list of tuples, DataFrame(s), or PolarsNodeDataFrameInput(s) to add nodes. If a DataFrame or list of DataFrames is used, the add_nodes_pandas method is called. If PolarsNodeDataFrameInput(s) are provided, each tuple must include a DataFrame and the index column. If a group is specified, the nodes are added to the group.
- Parameters:
nodes (NodeInput) – Data representing nodes in various formats.
group (Optional[Group]) – The name of the group to add the nodes to. If not specified, the nodes are added to the GraphRecord without a group.
- Return type:
None
- add_nodes_pandas(nodes, group=None)[source]#
Adds nodes to the GraphRecord instance from one or more Pandas DataFrames.
This method accepts either a single tuple or a list of tuples, where each tuple consists of a Pandas DataFrame and an index column string. If a group is specified, the nodes are added to the group.
- Parameters:
nodes (Union[PandasNodeDataFrameInput, List[PandasNodeDataFrameInput]]) – A tuple or list of tuples, each with a DataFrame and index column.
group (Optional[Group]) – The name of the group to add the nodes to. If not specified, the nodes are added to the GraphRecord without a group.
- Return type:
None
- add_nodes_polars(nodes, group=None)[source]#
Adds nodes to the GraphRecord instance from one or more Polars DataFrames.
This method accepts either a single tuple or a list of tuples, where each tuple consists of a Polars DataFrame and an index column string. If a group is specified, the nodes are added to the group.
- Parameters:
nodes (Union[PolarsNodeDataFrameInput, List[PolarsNodeDataFrameInput]]) – A tuple or list of tuples, each with a DataFrame and index column.
group (Optional[Group]) – The name of the group to add the nodes to. If not specified, the nodes are added to the GraphRecord without a group.
- Return type:
None
- add_nodes_to_group(group, nodes)[source]#
Adds one or more nodes to a specified group in the GraphRecord.
- Parameters:
group (Group) – The name of the group to add nodes to.
nodes (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query to add to the group.
- Return type:
None- Returns:
None
- static builder()[source]#
Creates a GraphRecordBuilder instance to build a GraphRecord.
- Return type:
- Returns:
GraphRecordBuilder – A new builder instance.
- clear()[source]#
Clears all data from the GraphRecord instance.
Removes all nodes, edges, and groups, effectively resetting the instance.
- Return type:
None- Returns:
None
- clone()[source]#
Clones the GraphRecord instance.
- Return type:
- Returns:
GraphRecord – A clone of the GraphRecord instance.
- contains_edge(edge)[source]#
Checks whether a specific edge exists in the GraphRecord.
- Parameters:
edge (EdgeIndex) – The index of the edge to check.
- Return type:
bool- Returns:
bool – True if the edge exists, False otherwise.
- contains_group(group)[source]#
Checks whether a specific group exists in the GraphRecord.
- Parameters:
group (Group) – The name of the group to check.
- Return type:
bool- Returns:
bool – True if the group exists, False otherwise.
- contains_node(node)[source]#
Checks whether a specific node exists in the GraphRecord.
- Parameters:
node (NodeIndex) – The index of the node to check.
- Return type:
bool- Returns:
bool – True if the node exists, False otherwise.
- property edge: EdgeIndexer#
Provides access to edge attributes within the GraphRecord via an indexer.
Facilitates querying, accessing, manipulating, and setting edge attributes using various indexing methods. Supports conditions and ranges for more complex queries.
- Returns:
EdgeIndexer – An object for manipulating and querying edge attributes.
- edge_count()[source]#
Returns the total number of edges currently managed by the GraphRecord.
- Return type:
int- Returns:
int – The total number of edges.
- edge_endpoints(edge)[source]#
Retrieves the source and target nodes of the specified edge(s).
If a single edge index is provided, returns a tuple of node indices (source, target). If multiple edges are specified, returns a dictionary mapping each edge index to its tuple of node indices.
- Parameters:
edge (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]) – One or more edge indices or an edge query.
- Return type:
Union[tuple[Union[str,int],Union[str,int]],Dict[int,tuple[Union[str,int],Union[str,int]]]]- Returns:
- Union[tuple[NodeIndex, NodeIndex],
Dict[EdgeIndex, tuple[NodeIndex, NodeIndex]]]: Tuple of node indices or a dictionary mapping each edge to its node indices.
- Raises:
IndexError – If the query returned no results.
- property edges: List[int]#
Lists the edge indices in the GraphRecord instance.
Returns a list of all edge indices currently managed by the GraphRecord instance.
- Returns:
List[EdgeIndex] – A list of edge indices.
- edges_connecting(source_node, target_node, directed=EdgesDirected.DIRECTED)[source]#
Retrieves the edges connecting the specified source and target nodes.
If a NodeOperation is provided for either the source or target nodes, it is first evaluated to obtain the corresponding node indices. The method then returns a list of edge indices that connect the specified source and target nodes.
- Parameters:
source_node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – The index or indices of the source node(s), or a node query to select source nodes.
target_node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – The index or indices of the target node(s), or a node query to select target nodes.
directed (EdgesDirected, optional) – Whether to consider edges as directed. Defaults to EdgesDirected.DIRECTED.
- Return type:
List[int]- Returns:
List[EdgeIndex] –
- A list of edge indices connecting the specified source and
target nodes.
- edges_in_group(group)[source]#
Retrieves the edge indices associated with the specified group(s).
If a single group is specified, returns a list of edge indices for that group. If multiple groups are specified, returns a dictionary mapping each group name to its list of edge indices.
- Parameters:
group (GroupInputList) – One or more group names.
- Return type:
Union[List[int],Dict[Union[str,int],List[int]]]- Returns:
Union[List[EdgeIndex], Dict[Group, List[EdgeIndex]]] –
- Edge indices
associated with the specified group(s).
- freeze_schema()[source]#
Freezes the schema. No changes are automatically inferred.
- Return type:
None
- classmethod from_pandas(nodes, edges=None)[source]#
Creates a GraphRecord from Pandas DataFrames of nodes and optionally edges.
Accepts a tuple or a list of tuples for nodes and edges. Each node tuple consists of a Pandas DataFrame and an index column. Edge tuples include a DataFrame and index columns for source and target nodes.
- Parameters:
- Return type:
- Returns:
GraphRecord – A new instance from the provided DataFrames.
- classmethod from_polars(nodes, edges=None)[source]#
Creates a GraphRecord from Polars DataFrames of nodes and optionally edges.
Accepts a tuple or a list of tuples for nodes and edges. Each node tuple consists of a Polars DataFrame and an index column. Edge tuples include a DataFrame and index columns for source and target nodes.
- Parameters:
- Return type:
- Returns:
GraphRecord – A new instance from the provided Polars DataFrames.
- classmethod from_ron(path)[source]#
Creates a GraphRecord instance from a RON file.
Reads node and edge data from a RON file specified by the path and creates a new GraphRecord instance using this data.
- Parameters:
path (str) – Path to the RON file.
- Return type:
- Returns:
GraphRecord – A new instance created from the RON file.
- classmethod from_tuples(nodes, edges=None)[source]#
Creates a GraphRecord instance from lists of node and edge tuples.
Nodes and edges are specified as lists of tuples. Each node tuple contains a node index and attributes. Each edge tuple includes indices of the source and target nodes and edge attributes.
- Parameters:
nodes (Sequence[NodeTuple]) – Sequence of node tuples.
edges (Optional[Sequence[EdgeTuple]]) – Sequence of edge tuples.
- Return type:
- Returns:
GraphRecord – A new instance created from the provided tuples.
- get_schema()[source]#
Returns a copy of the GraphRecord’s schema.
- Return type:
- Returns:
Schema – The schema of the GraphRecord.
- group(group)[source]#
Returns the node and edge indices associated with the specified group/s.
If a single group is specified, returns a list of node and edge indices for that group. If multiple groups are specified, returns a dictionary with each group name mapping to its list of node and edge indices indices.
- group_count()[source]#
Returns the total number of groups currently defined within the GraphRecord.
- Return type:
int- Returns:
int – The total number of groups.
- group_overview(group, truncate_details=80)[source]#
Generates an overview of a specific group in the GraphRecord instance.
- Parameters:
group (Group) – The name of the group to generate an overview for.
truncate_details (int, optional) – The maximum number of detail characters to include in the overview. No truncation if None. Defaults to DEFAULT_TRUNCATE_DETAILS.
- Return type:
GroupOverview- Returns:
GroupOverview – An overview of the specified group.
- property groups: List[str | int]#
Lists the groups in the GraphRecord instance.
Returns a list of all groups currently defined within the GraphRecord instance.
- Returns:
List[Group] – A list of groups.
- groups_of_edge(edge)[source]#
Retrieves the groups associated with the specified edge(s) in the GraphRecord.
If a single edge index is provided, returns a list of groups for that edge. If multiple edges are specified, returns a dictionary mapping each edge index to its list of groups.
- Parameters:
edge (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]) – One or more edge indices or an edge query.
- Return type:
Union[List[Union[str,int]],Dict[int,List[Union[str,int]]]]- Returns:
Union[List[Group], Dict[EdgeIndex, List[Group]]] –
- Groups associated with
each edge.
- groups_of_node(node)[source]#
Retrieves the groups associated with the specified node(s) in the GraphRecord.
If a single node index is provided, returns a list of groups for that node. If multiple nodes are specified, returns a dictionary mapping each node index to its list of groups.
- Parameters:
node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query.
- Return type:
Union[List[Union[str,int]],Dict[Union[str,int],List[Union[str,int]]]]- Returns:
Union[List[Group], Dict[NodeIndex, List[Group]]] –
- Groups associated with
each node.
- incoming_edges(node)[source]#
Lists the incoming edges of the specified node(s) in the GraphRecord.
If a single node index is provided, returns a list of its incoming edge indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of incoming edge indices.
- Parameters:
node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query.
- Return type:
Union[List[int],Dict[Union[str,int],List[int]]]- Returns:
Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]] –
- Incoming
edge indices for each specified node.
- neighbors(node, directed=EdgesDirected.DIRECTED)[source]#
Retrieves the neighbors of the specified node(s) in the GraphRecord.
If a single node index is provided, returns a list of its neighboring node indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of neighboring nodes.
- Parameters:
node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a query that returns node indices.
directed (EdgesDirected, optional) – Whether to consider edges as directed. Defaults to EdgesDirected.DIRECTED.
- Return type:
Union[List[Union[str,int]],Dict[Union[str,int],List[Union[str,int]]]]- Returns:
Union[List[NodeIndex], Dict[NodeIndex, List[NodeIndex]]] – Neighboring nodes.
- property node: NodeIndexer#
Provides access to node attributes within the GraphRecord via an indexer.
Facilitates querying, accessing, manipulating, and setting node attributes using various indexing methods. Supports conditions and ranges for more complex queries.
- Returns:
NodeIndexer – An object for manipulating and querying node attributes.
- node_count()[source]#
Returns the total number of nodes currently managed by the GraphRecord.
- Return type:
int- Returns:
int – The total number of nodes.
- property nodes: List[str | int]#
Lists the node indices in the GraphRecord instance.
Returns a list of all node indices currently managed by the GraphRecord instance.
- Returns:
List[NodeIndex] – A list of node indices.
- nodes_in_group(group)[source]#
Retrieves the node indices associated with the specified group/s.
If a single group is specified, returns a list of node indices for that group. If multiple groups are specified, returns a dictionary mapping each group name to its list of node indices.
- Parameters:
group (GroupInputList) – One or more group names.
- Return type:
Union[List[Union[str,int]],Dict[Union[str,int],List[Union[str,int]]]]- Returns:
Union[List[NodeIndex], Dict[Group, List[NodeIndex]]] –
- Node indices
associated with the specified group(s).
- outgoing_edges(node)[source]#
Lists the outgoing edges of the specified node(s) in the GraphRecord.
If a single node index is provided, returns a list of its outgoing edge indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of outgoing edge indices.
- Parameters:
node (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query.
- Return type:
Union[List[int],Dict[Union[str,int],List[int]]]- Returns:
Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]] –
- Outgoing
edge indices for each specified node.
- overview(truncate_details=80)[source]#
Generates an overview of the GraphRecord instance.
- Parameters:
truncate_details (int, optional) – The maximum number of detail characters to include in the overview. No truncation if None. Defaults to DEFAULT_TRUNCATE_DETAILS.
- Return type:
Overview- Returns:
Overview – An overview of the GraphRecord instance.
- query_edges(query)[source]#
Retrieves information on the edges from the GraphRecord given the query.
- Parameters:
query (EdgeQuery) – A query to define the information to be retrieved. The query should be a callable that takes an EdgeOperand and returns a QueryReturnOperand.
- Return type:
QueryResult
- Returns:
QueryResult –
- The result of the query, which can be a list of edge indices or
a dictionary of edge attributes, among others.
- query_nodes(query)[source]#
Retrieves information on the nodes from the GraphRecord given the query.
- Parameters:
query (NodeQuery) – A query to define the information to be retrieved. The query should be a callable that takes a NodeOperand and returns a QueryReturnOperand.
- Return type:
QueryResult
- Returns:
QueryResult –
- The result of the query, which can be a list of node indices
or a dictionary of node attributes, among others.
- remove_edges(edges)[source]#
Removes edges from the GraphRecord and returns their attributes.
If a single edge index is provided, returns the attributes of the removed edge. If multiple edge indices are specified, returns a dictionary mapping each edge index to its attributes.
- Parameters:
edges (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]) – One or more edge indices or an edge query.
- Return type:
Union[Dict[Union[str,int],Union[str,int,float,bool,datetime,timedelta,None]],Dict[int,Dict[Union[str,int],Union[str,int,float,bool,datetime,timedelta,None]]]]- Returns:
Union[Attributes, Dict[EdgeIndex, Attributes]] –
- Attributes of the
removed edge(s).
- remove_edges_from_group(group, edges)[source]#
Removes one or more edges from a specified group in the GraphRecord.
- Parameters:
group (Group) – The name of the group from which to remove edges.
edges (Union[EdgeIndex, EdgeIndexInputList, EdgeIndexQuery, EdgeIndicesQuery]) – One or more edge indices or an edge query to remove from the group.
- Return type:
None- Returns:
None
- remove_groups(groups)[source]#
Removes one or more groups from the GraphRecord instance.
- Parameters:
groups (Union[Group, GroupInputList]) – One or more group names to remove.
- Return type:
None- Returns:
None
- remove_nodes(nodes)[source]#
Removes nodes from the GraphRecord and returns their attributes.
If a single node index is provided, returns the attributes of the removed node. If multiple node indices are specified, returns a dictionary mapping each node index to its attributes.
- Parameters:
nodes (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query.
- Return type:
Union[Dict[Union[str,int],Union[str,int,float,bool,datetime,timedelta,None]],Dict[Union[str,int],Dict[Union[str,int],Union[str,int,float,bool,datetime,timedelta,None]]]]- Returns:
Union[Attributes, Dict[NodeIndex, Attributes]] –
- Attributes of the
removed node(s).
- remove_nodes_from_group(group, nodes)[source]#
Removes one or more nodes from a specified group in the GraphRecord.
- Parameters:
group (Group) – The name of the group from which to remove nodes.
nodes (Union[NodeIndex, NodeIndexInputList, NodeIndexQuery, NodeIndicesQuery]) – One or more node indices or a node query to remove from the group.
- Return type:
None- Returns:
None
- set_schema(schema)[source]#
Sets the schema of the GraphRecord instance.
- Parameters:
schema (Schema) – The new schema to apply.
- Return type:
None
- to_pandas()[source]#
Exports the GraphRecord instance to Pandas DataFrames.
- Return type:
- Returns:
PandasDataFramesExport –
- A dictionary containing ‘ungrouped’ and
’groups’ DataFrames.
- to_polars()[source]#
Exports the GraphRecord instance to Polars DataFrames.
- Return type:
- Returns:
PolarsDataFramesExport –
- A dictionary containing ‘ungrouped’ and
’groups’ DataFrames.
- to_ron(path)[source]#
Writes the GraphRecord instance to a RON file.
Serializes the GraphRecord instance to a RON file at the specified path.
- Parameters:
path (str) – Path where the RON file will be written.
- Return type:
None
- unfreeze_schema()[source]#
Unfreezes the schema. Changes are automatically inferred.
- Return type:
None
- ungrouped_edges()[source]#
Retrieves the edge indices that are not associated with any group.
- Return type:
List[int]- Returns:
List[EdgeIndex] – Edge indices that are ungrouped.
- ungrouped_nodes()[source]#
Retrieves the node indices that are not associated with any group.
- Return type:
List[Union[str,int]]- Returns:
List[NodeIndex] – Node indices that are ungrouped.