313b79ce9cc8538a78edfc82ccc7b02c23766287,osmnx/utils_graph.py,,graph_from_gdfs,#Any#Any#Any#,104
Before Change
G = nx.MultiDiGraph(**graph_attrs)
// add the nodes then each node"s non-null attributes
G.add_nodes_from(gdf_nodes.index)
for col in gdf_nodes.columns:
nx.set_node_attributes(G, name=col, values=gdf_nodes[col].dropna())
// add each edge and its non-null attributes
After Change
G = nx.MultiDiGraph(**graph_attrs)
attr_col_headings = [c for c in gdf_edges.columns if c not in ["u", "v"]]
attribute_data = zip(*[gdf_edges[col] for col in attr_col_headings])
multigraph_edge_keys = gdf_edges["key"]
attribute_data = zip(attribute_data, multigraph_edge_keys)
// Generate graph edges
for s, t, attrs in zip(gdf_edges["u"], gdf_edges["v"], attribute_data):
attrs, multigraph_edge_key = attrs
key = G.add_edge(s, t, key=multigraph_edge_key)
G[s][t][key].update(zip(attr_col_headings, attrs))
// Add nodes attributes
for col in gdf_nodes.columns:
nx.set_node_attributes(G, name=col, values=gdf_nodes[col].dropna())
utils.log("Created graph from node/edge GeoDataFrames")
In pattern: SUPERPATTERN
Frequency: 5
Non-data size: 3
Instances Project Name: gboeing/osmnx
Commit Name: 313b79ce9cc8538a78edfc82ccc7b02c23766287
Time: 2020-10-20
Author: 44049940+Labulitiolle@users.noreply.github.com
File Name: osmnx/utils_graph.py
Class Name:
Method Name: graph_from_gdfs
Project Name: pgmpy/pgmpy
Commit Name: 73dcacffa7dee910a9478cd7d783d91ef84dc987
Time: 2013-09-21
Author: snigam3112@gmail.com
File Name: BayesianModel.py
Class Name: BayesianModel
Method Name: add_nodes
Project Name: stellargraph/stellargraph
Commit Name: 2d33217ca2c689ff8e577956325291dbe221da70
Time: 2018-07-11
Author: docherty@gmail.com
File Name: tests/data/test_stellargraph.py
Class Name:
Method Name: test_digraph_schema
Project Name: stellargraph/stellargraph
Commit Name: 2d33217ca2c689ff8e577956325291dbe221da70
Time: 2018-07-11
Author: docherty@gmail.com
File Name: tests/data/test_stellargraph.py
Class Name:
Method Name: test_graph_schema
Project Name: pgmpy/pgmpy
Commit Name: eea41a4578b5021bbc16eb171bceb453cbde2419
Time: 2014-11-30
Author: abinash.panda.ece10@itbhu.ac.in
File Name: pgmpy/models/BayesianModel.py
Class Name: BayesianModel
Method Name: add_nodes_from