Biblioteka GraphStream

Biblioteka GraphStream
download
dokumentacja

GraphStream is a java library that manages dynamic graphs. It is composed of an object oriented API that gives an easy and quick way to construct and evolve edges and nodes in a graph.

Przyklad wykorzystania:

package org.miv.graphstream.ui.swing.test;

import org.miv.graphstream.graph.Graph;
import org.miv.graphstream.graph.Node;
import org.miv.graphstream.graph.implementations.DefaultGraph;
import org.miv.graphstream.ui.GraphViewerRemote;

/**
 * The purpose of this test is to show the various styling possibilities.
 * 
 * @author Antoine Dutot
 */
public class TutorialUI002d
{
    public static void main( String args[] )
    {
        new TutorialUI002d();
    }

    public TutorialUI002d()
    {
        Graph graph = new DefaultGraph( false, true );

        GraphViewerRemote viewerRemote = graph.display( false );

        viewerRemote.setQuality( 3 );

        Node A = graph.addNode( "A" );
        Node B = graph.addNode( "B" );
        Node C = graph.addNode( "C" );
        Node D = graph.addNode( "D" );

        graph.addEdge( "AB", "A", "B", true );
        graph.addEdge( "BC", "B", "C", true );
        graph.addEdge( "CA", "C", "A", false );
        graph.addEdge( "AD", "A", "D", true );
        graph.addEdge( "DB", "D", "B", false );

        A.addAttribute( "x", 0 );
        A.addAttribute( "y", 1 );
        B.addAttribute( "x", -1 );
        B.addAttribute( "y", 0 );
        C.addAttribute( "x", 1 );
        C.addAttribute( "y", 0 );
        D.addAttribute( "x", 0 );
        D.addAttribute( "y", -1 );

        graph.addAttribute( "stylesheet", styleSheet1 );
    }

    protected static final String styleSheet1 =
          "graph {" +
          "        image:url('http://www.iconarchive.com/icons/flameia/aqua-smiles/make-fun-128x128.png');" +
          "        image-offset: -1gu -1gu;" +
          "     width: 2gu;" +
          "        height: 2gu;" +
          "}" +
          "node {" +
          "        width: 10%;" +
          "        height: 10%;" +
          "        node-shape: image;" +
          "        text-align: aside;" +
          "        border-width: 1px;" +
          "        border-color: red;" +
          "}" +
          "edge {" +
          "        color:#FF000055;" +
          "}";

}
wersja strony: 0, ostatnia edycja: 1210432670|%e %b %Y, %H:%M %Z (%O temu)
Jeśli nie zaznaczono inaczej, Zawartość tej strony dostępna jest na licencji Creative Commons Attribution-ShareAlike 3.0 License