Class SandboxGraph


  • public class SandboxGraph
    extends java.lang.Object
    • Constructor Detail

      • SandboxGraph

        public SandboxGraph​(Sandbox sandbox)
    • Method Detail

      • getSandboxInstanceID

        public int getSandboxInstanceID()
        Returns the sandbox instance this graph belongs to
        Returns:
      • edges

        public SandboxHashSet<SandboxEdge> edges​(SandboxNode node,
                                                 com.ensoftcorp.atlas.core.db.graph.GraphElement.NodeDirection direction)
        Gets the node's predecessor or successor edges in this graph
        Parameters:
        node -
        direction -
        Returns:
      • limit

        public SandboxHashSet<SandboxNode> limit​(com.ensoftcorp.atlas.core.db.graph.GraphElement.NodeDirection direction)
        Returns the nodes in the graph without edges from the given direction
        Parameters:
        direction -
        Returns:
      • leaves

        public SandboxHashSet<SandboxNode> leaves()
        Selects the nodes of this graph that have no successors Convenience for limit(NodeDirection.OUT)
        Returns:
      • roots

        public SandboxHashSet<SandboxNode> roots()
        Selects the nodes of this graph that have no predecessors Convenience for limit(NodeDirection.IN)
        Returns:
      • nodes

        public SandboxHashSet<SandboxNode> nodes​(java.lang.String... tags)
        A convenience method for nodes(String... tags)
        Parameters:
        tags -
        Returns:
      • nodesTaggedWithAny

        public SandboxHashSet<SandboxNode> nodesTaggedWithAny​(java.lang.String... tags)
        Returns the set of nodes from this graph that are tagged with all of the given tags
        Parameters:
        tags -
        Returns:
      • nodesTaggedWithAll

        public SandboxHashSet<SandboxNode> nodesTaggedWithAll​(java.lang.String... tags)
        Returns the set of nodes from this graph that are tagged with any of the given tags
        Parameters:
        tags -
        Returns:
      • edges

        public SandboxHashSet<SandboxEdge> edges​(java.lang.String... tags)
        A convenience method for edges(String... tags)
        Parameters:
        tags -
        Returns:
      • edgesTaggedWithAny

        public SandboxHashSet<SandboxEdge> edgesTaggedWithAny​(java.lang.String... tags)
        Returns the set of edges from this graph that are tagged with any of the given tags
        Parameters:
        tags -
        Returns:
      • edgesTaggedWithAll

        public SandboxHashSet<SandboxEdge> edgesTaggedWithAll​(java.lang.String... tags)
        Returns the set of edges from this graph that are tagged with all of the given tags
        Parameters:
        tags -
        Returns:
      • predecessors

        public SandboxHashSet<SandboxNode> predecessors​(SandboxNode node)
        Gets the predecessor nodes of the given node for this graph's edges
        Parameters:
        node -
        Returns:
        The set of incoming edges to the given node
      • successors

        public SandboxHashSet<SandboxNode> successors​(SandboxNode node)
        Gets the successor nodes of the given node for this graph's edges
        Parameters:
        node -
        Returns:
        The set of out-coming edges from the given node
      • forwardStep

        public SandboxGraph forwardStep​(SandboxNode origin)
        From this graph, selects the subgraph reachable from the given nodes along a path length of 1 in the forward direction. The final result includes the given nodes, the traversed edges, and the reachable nodes.
        Parameters:
        origin -
        Returns:
      • forwardStep

        public SandboxGraph forwardStep​(SandboxHashSet<SandboxNode> origin)
        From this graph, selects the subgraph reachable from the given nodes along a path length of 1 in the forward direction. The final result includes the given nodes, the traversed edges, and the reachable nodes.
        Parameters:
        origin -
        Returns:
      • reverseStep

        public SandboxGraph reverseStep​(SandboxNode origin)
        From this graph, selects the subgraph reachable from the given nodes along a path length of 1 in the reverse direction. The final result includes the given nodes, the traversed edges, and the reachable nodes.
        Parameters:
        origin -
        Returns:
      • reverseStep

        public SandboxGraph reverseStep​(SandboxHashSet<SandboxNode> origin)
        From this graph, selects the subgraph reachable from the given nodes along a path length of 1 in the reverse direction. The final result includes the given nodes, the traversed edges, and the reachable nodes.
        Parameters:
        origin -
        Returns:
      • union

        public SandboxGraph union​(SandboxGraph... graphs)
        Yields the union of this graph and the given graphs. That is, the resulting graph's nodes are the union of all nodes, and likewise for edges.
        Parameters:
        a -
        graphs -
        Returns:
      • difference

        public SandboxGraph difference​(SandboxGraph... graphs)
        Select this graph, excluding the graphs g. Note that, because an edge is only in a graph if it's nodes are in a graph, removing an edge will necessarily remove the nodes it connects as well. Removing either node would remove the edge as well. This behavior may seem counter-intuitive if one is thinking in terms of removing a single edge from a graph. Consider the graphs: - g1: a -> b -> c - g2: a -> b g1.remove(g2) yields the graph containing only node c: because b is removed, so b -> c is also removed. In general, this operation is useful for removing nodes from a graph, but may not be as useful for operating on edges.
        Parameters:
        a -
        b -
        Returns:
      • differenceEdges

        public SandboxGraph differenceEdges​(SandboxGraph... graphs)
        Select this graph, excluding the edges from the given graphs.
        Parameters:
        a -
        b -
        Returns:
      • intersection

        public SandboxGraph intersection​(SandboxGraph... graphs)
        Yields the intersection of this graph and the given graphs. That is, the resulting graph's nodes are the intersection of all node sets, and likewise for edges.
        Parameters:
        a -
        b -
        Returns:
      • betweenStep

        public SandboxGraph betweenStep​(SandboxNode from,
                                        SandboxNode to)
        From this graph, selects the subgraph such that the given nodes in to are reachable from the nodes in from in a single step
        Parameters:
        from -
        to -
        Returns:
      • between

        public SandboxGraph between​(SandboxNode from,
                                    SandboxNode to)
        From this graph, selects the subgraph such that the given nodes in to are reachable from the nodes in from using forward traversal. Logically equivalent to graph.forward(from).intersection(graph.reverse(to)) .
        Parameters:
        from -
        to -
        Returns:
      • between

        public SandboxGraph between​(SandboxHashSet<SandboxNode> from,
                                    SandboxHashSet<SandboxNode> to)
        From this graph, selects the subgraph such that the given nodes in to are reachable from the nodes in from using forward traversal. Logically equivalent to graph.forward(from).intersection(graph.reverse(to)) .
        Parameters:
        from -
        to -
        Returns:
      • forward

        public SandboxGraph forward​(SandboxNode origin)
        From this graph, selects the subgraph reachable from the given nodes using forward transitive traversal.
        Parameters:
        origin -
        Returns:
      • forward

        public SandboxGraph forward​(SandboxHashSet<SandboxNode> origin)
        From this graph, selects the subgraph reachable from the given nodes using forward transitive traversal.
        Parameters:
        origin -
        Returns:
      • reverse

        public SandboxGraph reverse​(SandboxNode origin)
        From this graph, selects the subgraph reachable from the given nodes using reverse transitive traversal.
        Parameters:
        origin -
        Returns:
      • reverse

        public SandboxGraph reverse​(SandboxHashSet<SandboxNode> origin)
        From this graph, selects the subgraph reachable from the given nodes using reverse transitive traversal.
        Parameters:
        origin -
        Returns: