Index
__all__ = ['IbisGraph', 'IbisGraphConstants', 'centrality', 'clustering', 'traversal', 'similarity']
module-attribute
IbisGraph
A graph representation using Ibis tables for nodes and edges.
This class provides a flexible graph data structure that can handle: - Directed and undirected graphs - Optional weighted edges - Integer-based node and edge identifiers
Attributes:
Name | Type | Description |
---|---|---|
nodes |
Table
|
Table containing node information. |
edges |
Table
|
Table containing edge connections. |
directed |
bool
|
Whether the graph is directed or undirected. |
num_nodes |
int
|
Total number of nodes in the graph. |
num_edges |
int
|
Total number of edges in the graph. |
Source code in ibisgraph/graph.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
edges
property
Get the edges table of the graph.
Returns:
Type | Description |
---|---|
Table
|
A table containing edges information with edges identifiers. |
is_directed
property
Check if the graph is directed.
Returns:
Type | Description |
---|---|
bool
|
True if the graph is directed, False otherwise. |
nodes
property
Get the nodes table of the graph.
Returns:
Type | Description |
---|---|
Table
|
A table containing node information with node identifiers. |
num_edges
property
Get the number of edges in the graph.
Returns:
Type | Description |
---|---|
int
|
The total number of edges in the graph. |
num_nodes
property
Get the number of nodes in the graph.
Returns:
Type | Description |
---|---|
int
|
The total number of nodes in the graph. |
__init__(nodes, edges, directed=False, id_col='id', src_col='src', dst_col='dst', weight_col=None)
Initialize an IbisGraph with nodes and edges.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes
|
Table
|
Table containing node information. |
required |
edges
|
Table
|
Table containing edge connections. |
required |
directed
|
bool
|
Whether the graph is directed. Defaults to False. |
False
|
id_col
|
str
|
Column name for node IDs. Defaults to "id". |
'id'
|
src_col
|
str
|
Column name for source node in edges. Defaults to "src". |
'src'
|
dst_col
|
str
|
Column name for destination node in edges. Defaults to "dst". |
'dst'
|
weight_col
|
str | None
|
Column name for edge weights. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If input columns are missing or have incorrect data types. |
Source code in ibisgraph/graph.py
set_directed(value)
Set the directionality of the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
bool
|
Whether the graph should be directed or undirected. |
required |
Returns:
Type | Description |
---|---|
Self
|
The current graph instance for method chaining. |
Source code in ibisgraph/graph.py
IbisGraphConstants
Bases: Enum
Constants for standardizing column names and identifiers in graph data structures.
These constants provide a consistent naming convention for graph-related columns to ensure compatibility and ease of use across different graph processing operations.