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 — Add average node span to model analysis · RepGraph/RepGraph@f6e72e3

File tree

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

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

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/AbstractGraph.java
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,24 @@ public int compare(Node o1, Node o2) {
10181018
return returnInfo;
10191019
}
10201020

1021+
1022+
1023+
public float getAverageSpanLength(){
1024+
float val=0;
1025+
for (Node n:this.nodes.values()){
1026+
float span = 0;
1027+
if (n.getAnchors()!=null){
1028+
for (Anchors a:n.getAnchors()) {
1029+
span+= a.getEnd()-a.getFrom();
1030+
}
1031+
span/=n.getAnchors().size();
1032+
}
1033+
val+=span;
1034+
}
1035+
val/=this.nodes.values().size();
1036+
return val;
1037+
}
1038+
10211039
@Override
10221040
public boolean equals(Object o) {
10231041

Collapse file

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

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/AbstractModel.java
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public HashMap<String, String> modelAnalysis() throws IOException, InterruptedEx
7373
float total_nodes = 0;
7474
float total_edges = 0;
7575
float total_tokens = 0;
76+
float total_spans = 0;
7677
float total_directed_cyclic = 0;
7778
float total_undirected_cyclic = 0;
7879
float total_planar = 0;
@@ -82,6 +83,7 @@ public HashMap<String, String> modelAnalysis() throws IOException, InterruptedEx
8283
total_nodes += g.getNodes().values().size();
8384
total_edges += g.getEdges().size();
8485
total_tokens += g.getTokens().size();
86+
total_spans += g.getAverageSpanLength();
8587
if (g.isCyclic(true)){
8688
total_directed_cyclic++;
8789
}
@@ -101,6 +103,7 @@ public HashMap<String, String> modelAnalysis() throws IOException, InterruptedEx
101103
AnalysisInfo.put("Total Number of Nodes",Math.round(total_nodes)+"");
102104
AnalysisInfo.put("Total Number of Edges",Math.round(total_edges)+"");
103105
AnalysisInfo.put("Total Number of Tokens",Math.round(total_tokens)+"");
106+
AnalysisInfo.put("Average Span of Node",Precision.round(total_spans/graphs.values().size(),2)+"");
104107
AnalysisInfo.put("Average Number of Nodes",Precision.round(total_nodes/graphs.values().size(),2)+"");
105108
AnalysisInfo.put("Average Number of Edges",Precision.round(total_edges/graphs.values().size(),2)+"");
106109
AnalysisInfo.put("Average Number of Tokens",Precision.round(total_tokens/graphs.values().size(),2)+"");

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.