8.1.1 Loading a Graph
The following describes the steps for loading a graph:
- Create a Session and an Analyst.
Creating a Session and an Analyst Using JShell
cd /opt/oracle/graph/ ./bin/opg4j // starting the shell will create an implicit session and analyst
Creating a Session and an Analyst Using Javaimport oracle.pgx.api.*; import oracle.pgx.api.mllib.DeepWalkModel; import oracle.pgx.api.frames.*; ... PgxSession session = Pgx.createSession("my-session"); Analyst analyst = session.createAnalyst();
Creating a Session and an Analyst Using Pythonsession = pypgx.get_session(session_name="my-session") analyst = session.create_analyst()
- Load the graph.
Note:
Though the DeepWalk algorithm implementation can be applied to directed or undirected graphs, currently only undirected random walks are considered.Loading a graph using JShellopg4j> var graph = session.readGraphWithProperties("<path>/<graph.json>");
Loading a graph using JavaPgxGraph graph = session.readGraphWithProperties("<path>/<graph.json>");
Loading a graph using Pythongraph = session.read_graph_with_properties("<path>/<graph.json>")
Parent topic: Using the DeepWalk Algorithm