Class DirectedWeightedSubgraph

All Implemented Interfaces:
Serializable, org.jgrapht.Graph<SWCPoint,SWCWeightedEdge>

public class DirectedWeightedSubgraph extends org.jgrapht.graph.AsSubgraph<SWCPoint,SWCWeightedEdge>
Class for accessing the sub-graph that has a subset of vertices and a subset of edges of a DirectedWeightedGraph.
Author:
Tiago Ferreira, Cameron Arshadi
See Also:
  • Constructor Details

    • DirectedWeightedSubgraph

      protected DirectedWeightedSubgraph(DirectedWeightedGraph graph, Set<SWCPoint> nodeSubset)
      Creates a subgraph from a sub-set of nodes.
      Parameters:
      graph - the graph from which nodeSubset were extracted.
      nodeSubset - the sub-set of nodes that define the sub-graph.
  • Method Details

    • setRoot

      public void setRoot(SWCPoint newRoot)
      Sets the root of the tree. This modifies the edge directions such that all other nodes in the graph have the new root as ancestor.
      Parameters:
      newRoot - the new root of the tree, which must be an existing vertex of the graph
      Throws:
      IllegalArgumentException - if the graph does not contain newRoot
    • sumEdgeWeights

      public double sumEdgeWeights(boolean adjusted)
      Gets the sum of all edge weights.
      Parameters:
      adjusted - whether edges of parent graph should be taken into account
      Returns:
      the sum of all edge weights
    • getDepthFirstIterator

    • getDepthFirstIterator

      public org.jgrapht.traverse.DepthFirstIterator<SWCPoint,SWCWeightedEdge> getDepthFirstIterator(SWCPoint startVertex)
    • getBPs

      public List<SWCPoint> getBPs()
      Gets the branch points (junctions) of the graph.
      Returns:
      the list of branch points
    • getTips

      public List<SWCPoint> getTips()
      Gets the end points (tips) of the subgraph.
      Returns:
      the list of end points
    • getRoot

      public SWCPoint getRoot()
      Gets the root of this graph.
      Returns:
      the root node.
    • getNodeStatistics

      public NodeStatistics<SWCPoint> getNodeStatistics(String type)
    • getTree

      public Tree getTree()
      Returns the tree associated with the parent's graph
      Returns:
      the associated tree
    • show

      public Window show()
      Displays this graph in a new instance of SNT's "Dendrogram Viewer".
      Returns:
      a reference to the displayed window.
    • setLabel

      public void setLabel(String label)
      Sets an identifying label for this subgraph.
      Parameters:
      label - the identifying string
    • getLabel

      public String getLabel()
      Returns the label identifying this subgraph.
      Returns:
      the label (or null) if none has been set.