utils
Attributes¶
Functions¶
extract_networkx_nodes_as_table(graph: nx.Graph, label_attr_name: Union[str, None, Iterable[str]] = None, ignore_attributes: Union[None, Iterable[str]] = None) -> Tuple[pa.Table, Dict[Hashable, int]]
¶
Extract the nodes of a networkx graph as a pyarrow table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph |
nx.Graph
|
the networkx graph |
required |
label_attr_name |
Union[str, None, Iterable[str]]
|
the name of the node attribute that should be used as label. If None, the node id is used. |
None
|
ignore_attributes |
Union[None, Iterable[str]]
|
a list of node attributes that should be ignored and not added to the table |
None
|
Returns:
Type | Description |
---|---|
Tuple[pa.Table, Dict[Hashable, int]]
|
a tuple with the table and a map containing the original node id as key and the newly created internal node id (int) as value |
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/network_analysis/utils.py
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 |
|
extract_networkx_edges_as_table(graph: nx.Graph, node_id_map: Dict[Hashable, int]) -> pa.Table
¶
Extract the edges of this graph as a pyarrow table.
The provided node_id_map
might be modified if a node id is not yet in the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph |
nx.Graph
|
The graph to extract edges from. |
required |
node_id_map |
Dict[Hashable, int]
|
A mapping from (original) node ids to (kiara-internal) (integer) node-ids. |
required |
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/network_analysis/utils.py
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 156 157 158 159 160 |
|
augment_nodes_table_with_connection_counts(nodes_table: Union[pa.Table, pl.DataFrame], edges_table: Union[pa.Table, pl.Dataframe]) -> pa.Table
¶
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/network_analysis/utils.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
augment_edges_table_with_id_and_weights(edges_table: Union[pa.Table, pl.DataFrame]) -> pa.Table
¶
Augment the edges table with additional pre-computed columns for directed and undirected weights..
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/network_analysis/utils.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|