2

I just came into contact with the field of graph database or graph data visualization this week. I want to use JanusGraph for graph analysis and visualization. I hope to import and process graph data in c#, and then click a button in c# WebUI, and the analyzed graph data will be automatically transferred to Gephi and become a beautiful graph.

In order to achieve this goal, I first set up a simple environment. I use janusgraph-full-1.0.0-rc2, run gremlin-server.bat, it stands to reason that the data backend I use should be inmemory, and the index backend is not used. I first tried to add vertices to the JanusGraph instance, running the following code in VSCode:

private  static  void  Main()
{
    Console.WriteLine("Hello, World!");

    var  client  =  new  GremlinClient(new  GremlinServer("localhost", 8182));
    var  g  =  Traversal().WithRemote(new  DriverRemoteConnection(client));

    var  vertex  =  g.AddV("person").Property("name", "Alice").Property("age", 25).Next();

    var  vertices  =  g.V().ToList();
    if (vertices.Count  ==  0)
    {
        Console.WriteLine("no");
    }
    else
    {
        foreach (var  vertex2  in  vertices)
        {
            Console.WriteLine(vertex2.Id);
        }
    }

    client.Dispose();
    Console.WriteLine("Bye-Bye, World!");
}

It produced output like this:

PS D:\\Programming\\GremlinExample> dotnet run
Hello, World!
4208
Bye-Bye, World!

It looks like I successfully added the vertex with ID 4208 to the JanusGraph instance, I can check the correctness of this operation by running the following command in the Gremlin console:

gremlin> :remote connect tinkerpop.server conf/remote-objects.yaml
==>Configured localhost/127.0.0.1:8182
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - \[localhost/127.0.0.1:8182\] - type ':remote console' to return to local mode
gremlin> graph = g.V().hasLabel('person')
==>v[4208]


Next, I need to send the vertices I added to Gephi. But I found myself only know how to send "temporary graph data" to Gephi in Gremlin console, which is the following code:

gremlin> :remote connect tinkerpop.server conf/remote-objects.yaml
gremlin> :remote console
gremlin> :plugin use tinkerpop.gephi
gremlin> :remote connect tinkerpop.gephi
gremlin> graph = TinkerFactory.createModern()
gremlin> :> graph

I'm starting to get confused, how do I send the 4208 vertex I just added to Gephi in the c# environment through something like Http?

isnf-uZ4
  • 53
  • 6

0 Answers0