Graphene

One Social Networking Graph Language to rule them all.

View project onGitHub

Graphene Logo

Graphene

social network graph language interpreter

Graphene makes graph manipulation and social network data analysis convenient using a purpose-built interpreted programming language. The motivation for our language is the massive commonplace use of graphs and graph based data mining algorithms in today's software world. At the same time, we see a large bubble of social network and social network-like applications which manage a large backend of data which can usually be represented using a graph structure.

Most of today's languages do not provide out-of-the-box or easy to use features for graph initialization, operations and management. Graphene will provide this interface to be able to support generic graph algorithms as well as specific social network applications based computations on graph-like data structures.


Usage

Usage: ./graphene (test [-t <number>| -i] | -f <file_path> | -h | -d)

Options:
  test                  Run regression tests to test the compiler's sanity
      -t                Specify Tests to run
      -i                Run tests in isolated mode
  -f                    Interpret source from file on disk
  -h                    Show help message and exit
  -d                    See under the hood. Use with caution!

./graphene test
      Run all built-in tests

./graphene test -t 1
      Run only designated tests against the compiler, in the example, only Test #1.

./graphene test -i
      Run all built-in tests, but in isolated mode. The effects of commands in one test do not persist when the next test starts.

./graphene -f samples/graph.ene
      Interpret source from a file on disk. File path is from CWD.


In Action!

Standard graph view with profile card:

Real anonymized facebook data set shown here, courtesy Stanford University.
Profile attributes generated at pseudo-random.


  
  person has name,city,picture;
  graph = input("person","data/0.edges");
  output();
  

The program above illustrates ease of use to handle large graphs.

See this in action!

Standard View with Profile Card


Mesh creation and output:


From:
  
  $ ./graphene 
  graphene> person has name,city,picture;
  graphene> graph = mesh(20, "person");
  graphene> output();
  graphene> exit();
  

This starts the user off with a mesh graph (every node connected to every other node). Helps ease work with highly connected graphs, which can be formed by removing appropriate edges.

See this in action!

Mesh


Graph View with overlaid nodes. Highlighted nodes represent a Global Reach.


GlobalReach.ene:
  
    person has name,city,picture;
    graph = input("person","data/0.edges");
    
    
    def (graph) => getNodeWithMaxDegree
    {
        maxnode = graph.getNodes().first();
        maxdegree = graph.getAdjacent(graph.getNodes().first()).length();
        foreach(node in graph.getNodes())
        {     
             curr = graph.getAdjacent(node).length();
             if(curr > maxdegree)
             {
               maxnode = node;
               maxdegree = curr;
             };
        };
    } => (maxnode);
    
    def (graph) => GlobalReach
    {
        Nodes = [];
        while(graph.getNodes().length()!=0)
        {
            current = getNodeWithMaxDegree(graph);
            Nodes.append(current);
            foreach(node in graph.getAdjacent(current))
            {
                graph -= node;
            };
            graph -= current;
        };
    } => (Nodes);
    
    g = input("person","data/0.edges");
    l = GlobalReach(graph);
    
    output();    
  
To Run:
  
    $ ./graphene -f samples/GlobalReach.ene
  
This short, yet powerful program finds a (greedy) transitive closure of the graph that represents the small set of nodes that have Global Reach, calculated by 1 degree connectedness.

See this in action!

Overlay


Cluster View of a graph's nodes. Members of the same cluster are shown with a silhouette circle symbolizing membership.


Cluster.ene:
  
    person has name,city,picture;
    graph = input("person","data/1.edges");

    l = lambda (n1,n2):{ x=0; a=n1.["city"]; a=a[0]; b=n2.["city"]; b=b[0];
                         if(a==b){ x=1; }; } => (x);
    
    output().cluster(l);  
  
To Run:
  
    $ ./graphene -f samples/Cluster.ene
  
Yep, we have lambdas too! Given a graph with a set of nodes, and a user defined boolean lambda, clustering a graph is just a function call away!

See this in action!

Cluster


Graphical Interface i/p & o/p besides console support, to make things more interesting!

from input();

Input


To get started, read this.

Silent graph analyst by day, vigilante graph ninja by night [-_-]~