3db0f69797d05b8090e4f1c72e9428991e3f2ff0,tests/mapper/test_node_mappers.py,,example_hin_3,#Any#,79
Before Change
nodes_type_2 = [4, 5, 6]
// Create isolated graphs
G = nx.Graph()
G.add_nodes_from(nodes_type_1, label="t1")
G.add_nodes_from(nodes_type_2, label="t2")
G.add_edges_from([(0, 4), (1, 5)], label="e1")
G.add_edges_from([(0, 2)], label="e2")
// Node 2 has no edges of type 1
// Node 1 has no edges of type 2
// Node 6 has no edges
// Add example features
if feature_size_by_type is not None:
for v, vdata in G.nodes(data=True):
nt = vdata["label"]
vdata["feature"] = (int(v) + 10) * np.ones(
feature_size_by_type[nt], dtype="int"
)
G = StellarGraph(G, node_features="feature")
else:
G = StellarGraph(G)
return G, nodes_type_1, nodes_type_2
def test_nodemapper_constructor_nx():
After Change
nodes_type_1 = np.array([0, 1, 2])
nodes_type_2 = np.array([4, 5, 6])
nodes = {
"t1": pd.DataFrame(
repeated_features(10 + nodes_type_1, feature_size_by_type["t1"]),
index=nodes_type_1,
),
"t2": pd.DataFrame(
repeated_features(10 + nodes_type_2, feature_size_by_type["t2"]),
index=nodes_type_2,
),
}
edges = {
"e1": pd.DataFrame([(0, 4), (1, 5)], columns=["source", "target"]),
"e2": pd.DataFrame([(0, 2)], columns=["source", "target"], index=[2]),
}
// Node 2 has no edges of type 1
// Node 1 has no edges of type 2
// Node 6 has no edges
return StellarGraph(nodes, edges), nodes_type_1, nodes_type_2
def test_nodemapper_constructor_nx():
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 21
Instances
Project Name: stellargraph/stellargraph
Commit Name: 3db0f69797d05b8090e4f1c72e9428991e3f2ff0
Time: 2020-03-04
Author: Huon.Wilson@data61.csiro.au
File Name: tests/mapper/test_node_mappers.py
Class Name:
Method Name: example_hin_3
Project Name: stellargraph/stellargraph
Commit Name: 3db0f69797d05b8090e4f1c72e9428991e3f2ff0
Time: 2020-03-04
Author: Huon.Wilson@data61.csiro.au
File Name: tests/mapper/test_node_mappers.py
Class Name:
Method Name: example_hin_2
Project Name: stellargraph/stellargraph
Commit Name: 3db0f69797d05b8090e4f1c72e9428991e3f2ff0
Time: 2020-03-04
Author: Huon.Wilson@data61.csiro.au
File Name: tests/mapper/test_node_mappers.py
Class Name:
Method Name: example_hin_3
Project Name: stellargraph/stellargraph
Commit Name: b17c639862ab1b9ab14e8c55a70e0ce002967e3f
Time: 2020-03-03
Author: Huon.Wilson@data61.csiro.au
File Name: tests/mapper/test_link_mappers.py
Class Name:
Method Name: example_HIN_homo