Class GraphStreamUtils


  • public class GraphStreamUtils
    extends java.lang.Object
    Utility class providing methods related to GraphStream
    Author:
    Matteo Collica
    See Also:
    DynastyTree
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GraphStreamUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addClassToElement​(org.graphstream.graph.Element element, java.lang.String customClass)
      Given a GraphStream Element (a node or an edge) and a style class's name, add it to the element's 'ui.class' attribute (or set it as the only class if empty)
      static org.graphstream.graph.Node addNodeToGraph​(java.lang.String id, java.lang.String label, org.graphstream.graph.Graph graph)
      Create a node and add it to an existing GraphStream's graph
      static boolean areConnected​(org.graphstream.graph.Node firstNode, org.graphstream.graph.Node secondNode)
      Given two GraphStream nodes, check whether there is a connection between them
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GraphStreamUtils

        private GraphStreamUtils()
    • Method Detail

      • addClassToElement

        public static void addClassToElement​(org.graphstream.graph.Element element,
                                             java.lang.String customClass)
        Given a GraphStream Element (a node or an edge) and a style class's name, add it to the element's 'ui.class' attribute (or set it as the only class if empty)
        Parameters:
        element - a GraphStream element (a node or an edge)
        customClass - the class to be added to the element's 'ui.class' attribute
      • addNodeToGraph

        public static org.graphstream.graph.Node addNodeToGraph​(java.lang.String id,
                                                                java.lang.String label,
                                                                org.graphstream.graph.Graph graph)
        Create a node and add it to an existing GraphStream's graph
        Parameters:
        id - the node's ID
        label - the node's label text
        graph - the graph the node as to be added to
        Returns:
        the created and styled node
      • areConnected

        public static boolean areConnected​(org.graphstream.graph.Node firstNode,
                                           org.graphstream.graph.Node secondNode)
        Given two GraphStream nodes, check whether there is a connection between them
        Parameters:
        firstNode - the first node
        secondNode - the second node
        Returns:
        whether there is a connection between the two nodes