MCPcopy Create free account
hub / github.com/Pometry/Raphtory / build_graph

Function build_graph

python/tests/test_export.py:13–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def build_graph():
14 edges_df = pd.read_csv(base_dir / "data/network_traffic_edges.csv")
15 edges_df["timestamp"] = pd.to_datetime(edges_df["timestamp"]).astype(
16 "datetime64[ms, UTC]"
17 )
18
19 nodes_df = pd.read_csv(base_dir / "data/network_traffic_nodes.csv")
20 nodes_df["timestamp"] = pd.to_datetime(nodes_df["timestamp"]).astype(
21 "datetime64[ms, UTC]"
22 )
23 g = Graph()
24 g.load_edges(
25 edges_df,
26 time="timestamp",
27 src="source",
28 dst="destination",
29 properties=["data_size_MB"],
30 layer_col="transaction_type",
31 metadata=["is_encrypted"],
32 shared_metadata={"datasource": "data/network_traffic_edges.csv"},
33 )
34 g.load_nodes(
35 data=nodes_df,
36 id="server_id",
37 time="timestamp",
38 properties=["OS_version", "primary_function", "uptime_days"],
39 metadata=["server_name", "hardware_type"],
40 shared_metadata={"datasource": "data/network_traffic_edges.csv"},
41 )
42 return g
43
44
45def build_graph_without_datetime_type():

Callers 7

test_py_visFunction · 0.70
test_networkx_explodedFunction · 0.70
test_networkx_no_propsFunction · 0.70
test_networkx_no_historyFunction · 0.70
build_to_dfFunction · 0.70
test_to_dfFunction · 0.70

Calls 3

GraphClass · 0.90
load_edgesMethod · 0.45
load_nodesMethod · 0.45

Tested by

no test coverage detected