Class Graph


  • public class Graph
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Graph()  
      Graph​(java.lang.String label)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Edge addEdge​(Edge edge)  
      Node addNode​(Node node)  
      boolean ancestor​(Node child, Node parent)
      Checks whether there exists an ancestry relationship between two nodes (unidirectional).
      boolean equals​(java.lang.Object obj)  
      java.util.Set<Edge> getEdges()  
      java.util.Set<Edge> getEdges​(Node node)
      Returns all edges in this graph for which the specified node is either the source or the target node.
      java.util.Set<Edge> getEdges​(Node node, boolean source, boolean target)
      Returns all edges in this graph for which the specified node is either the source of the target node, depending on the specified flags.
      java.util.UUID getId()  
      java.lang.String getLabel()  
      java.util.Set<Node> getNodes()  
      org.eclipse.collections.impl.map.mutable.UnifiedMap<java.lang.String,​java.lang.Object> getProperties()  
      int hashCode()  
      void setEdges​(java.util.Set<Edge> edges)  
      void setNodes​(java.util.Set<Node> nodes)  
      void setProperties​(org.eclipse.collections.impl.map.mutable.UnifiedMap<java.lang.String,​java.lang.Object> properties)  
      • Methods inherited from class java.lang.Object

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

      • Graph

        public Graph()
      • Graph

        public Graph​(java.lang.String label)
    • Method Detail

      • getId

        public java.util.UUID getId()
      • addNode

        public Node addNode​(Node node)
      • addEdge

        public Edge addEdge​(Edge edge)
      • getNodes

        public java.util.Set<Node> getNodes()
      • setNodes

        public void setNodes​(java.util.Set<Node> nodes)
      • getEdges

        public java.util.Set<Edge> getEdges()
      • setEdges

        public void setEdges​(java.util.Set<Edge> edges)
      • getProperties

        public org.eclipse.collections.impl.map.mutable.UnifiedMap<java.lang.String,​java.lang.Object> getProperties()
      • setProperties

        public void setProperties​(org.eclipse.collections.impl.map.mutable.UnifiedMap<java.lang.String,​java.lang.Object> properties)
      • getLabel

        public java.lang.String getLabel()
      • getEdges

        public java.util.Set<Edge> getEdges​(Node node,
                                            boolean source,
                                            boolean target)
        Returns all edges in this graph for which the specified node is either the source of the target node, depending on the specified flags.
        Parameters:
        node - The node that should be part of the edge.
        source - When set to true, edges in which the specified node is the source node are included.
        target - When set to true, edges in which the specified node is the target node are included.
        Returns:
        The set of requested edges in which the specified node is present.
      • getEdges

        public java.util.Set<Edge> getEdges​(Node node)
        Returns all edges in this graph for which the specified node is either the source or the target node.
        Parameters:
        node - The node that should be part of the edge.
        Returns:
        The set of edges in which the specified node is either the source or the target node.
      • ancestor

        public boolean ancestor​(Node child,
                                Node parent)
        Checks whether there exists an ancestry relationship between two nodes (unidirectional). An ancestry relations exists when there is a path in the graph from the parent node to the child node. This implementation performs a depth-first search. *
        Parameters:
        child - The child node.
        parent - The parent node.
        Returns:
        Whether or not there exists an ancestry relation.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object