Skip to content

Commit 2e136eb

Browse files
committed
Knowing that Semgraph member is a Set should be easier to understand when looking at the collection of roots
Also, add a test of if a node is a root or not
1 parent cf97e36 commit 2e136eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/edu/stanford/nlp/semgraph/SemanticGraph.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class SemanticGraph implements Serializable {
6767
/**
6868
* The distinguished root vertices, if known.
6969
*/
70-
private final Collection<IndexedWord> roots;
70+
private final Set<IndexedWord> roots;
7171

7272
private final DirectedMultiGraph<IndexedWord, SemanticGraphEdge> graph;
7373

@@ -791,6 +791,10 @@ public Collection<IndexedWord> getRoots() {
791791
return roots;
792792
}
793793

794+
public boolean isRoot(IndexedWord vertex) {
795+
return roots.contains(vertex);
796+
}
797+
794798
/**
795799
* Initially looks for nodes which have no incoming arcs. If there are any, it
796800
* returns a list of them. If not, it looks for nodes from which every other

0 commit comments

Comments
 (0)