GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixed issue of node's not having correct surface property in subset c… · RepGraph/RepGraph@31bc907

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java/com/RepGraph
    • AbstractModel.java
    • Node.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/com/RepGraph/AbstractModel.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/AbstractModel.java
+21-14Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,19 @@ public AbstractGraph CreateSubsetDescendent(AbstractGraph parent, String headNod
239239
parent.setNodeNeighbours();
240240

241241
HashMap<String, Node> DescendentNodes = new HashMap<String, Node>();
242+
HashMap<String,Boolean> visited = new HashMap<>();
242243
ArrayList<Edge> DescendentEdges = new ArrayList<>();
243244
ArrayList<Token> SubsetTokens = new ArrayList<>();
244245

246+
for (Node n:parent.getNodes().values()) {
247+
visited.put(n.getId(),false);
248+
}
245249

246250
Node n = parent.getNodes().get(headNodeID);
247251

248252
//Add the head Node to the descendent nodes hashmap
249253
DescendentNodes.put(n.getId(), new Node(n));
254+
visited.put(n.getId(),true);
250255
for (Edge e : n.getDirectedEdgeNeighbours()) {
251256
DescendentEdges.add(new Edge(e));
252257
}
@@ -270,21 +275,24 @@ public AbstractGraph CreateSubsetDescendent(AbstractGraph parent, String headNod
270275
Stack<Node> stack = new Stack<>();
271276
while (n != null) {
272277
for (Node nn : n.getDirectedNeighbours()) {
273-
DescendentNodes.put(nn.getId(), new Node(nn));
274-
stack.push(nn);
275-
//Set the min and max span appropriately as found
276-
if (nn.getAnchors() != null) {
277-
for (int i = 0; i < nn.getAnchors().size(); i++) {
278-
if (nn.getAnchors().get(i).getFrom() < minFrom) {
279-
minFrom = nn.getAnchors().get(i).getFrom();
280-
}
281-
if (nn.getAnchors().get(i).getEnd() > maxEnd) {
282-
maxEnd = nn.getAnchors().get(i).getEnd();
278+
if (!visited.get(nn.getId())) {
279+
DescendentNodes.put(nn.getId(), new Node(nn));
280+
stack.push(nn);
281+
visited.put(nn.getId(), true);
282+
//Set the min and max span appropriately as found
283+
if (nn.getAnchors() != null) {
284+
for (int i = 0; i < nn.getAnchors().size(); i++) {
285+
if (nn.getAnchors().get(i).getFrom() < minFrom) {
286+
minFrom = nn.getAnchors().get(i).getFrom();
287+
}
288+
if (nn.getAnchors().get(i).getEnd() > maxEnd) {
289+
maxEnd = nn.getAnchors().get(i).getEnd();
290+
}
283291
}
284292
}
285-
}
286-
for (Edge ne : nn.getDirectedEdgeNeighbours()) {
287-
descEdge.put(ne.getSource() + " " + ne.getTarget(), new Edge(ne));
293+
for (Edge ne : nn.getDirectedEdgeNeighbours()) {
294+
descEdge.put(ne.getSource() + " " + ne.getTarget(), new Edge(ne));
295+
}
288296
}
289297
}
290298
if (!stack.empty()) {
@@ -310,7 +318,6 @@ public AbstractGraph CreateSubsetDescendent(AbstractGraph parent, String headNod
310318
return subset;
311319
}
312320

313-
314321
/**
315322
* Overloaded method to search for subgraph pattern using different parameters
316323
*
Collapse file

‎src/main/java/com/RepGraph/Node.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/Node.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public Node(Node n) {
102102
this.directedEdgeNeighbours = new ArrayList<>();
103103
this.directedNeighbours = new ArrayList<>();
104104
this.undirectedNeighbours = new ArrayList<>();
105-
105+
this.surface = n.surface;
106106
}
107107

108108
/**

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.