Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,7 @@ public String getToolTipText(MouseEvent e) {

private String getEdgeTypeName(String type) {
if (type == null) return "unknown";
switch (type) {
case "f": return "Friend";
case "c": return "Classmate";
case "fs": return "Familiar Stranger";
case "s": return "Stranger";
case "sg": return "Study Group";
default: return type;
}
return EdgeTypeRegistry.getName(type);
}

private Color getEdgeColor(Edge e) {
Expand Down
21 changes: 4 additions & 17 deletions Gvisual/src/gvisual/InteractiveHtmlExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,28 +401,15 @@ private String generateJs() {

/** Maps Edge type codes to human-readable names. */
private static String typeName(String type) {
if (type == null) return "Unknown";
switch (type) {
case "f": return "Friend";
case "fs": return "Facebook";
case "c": return "Classmate";
case "s": return "Stranger";
case "sg": return "Study Group";
default: return type;
}
return EdgeTypeRegistry.getName(type);
}

/** Maps Edge type codes to CSS colors. */
private static String typeColor(String type) {
if (type == null) return "#999";
switch (type) {
case "f": return "#4CAF50";
case "fs": return "#2196F3";
case "c": return "#FF9800";
case "s": return "#9E9E9E";
case "sg": return "#9C27B0";
default: return "#607D8B";
}
String hex = EdgeTypeRegistry.getHexColor(type);
// EdgeTypeRegistry returns "#CCCCCC" for unknowns; remap to our default
return "#CCCCCC".equals(hex) ? "#607D8B" : hex;
}

/**
Expand Down
9 changes: 7 additions & 2 deletions Gvisual/src/gvisual/NetworkReportGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ public int compare(Map.Entry<String, Integer> a, Map.Entry<String, Integer> b) {
friendEdges.size(), fsEdges.size(), classmateEdges.size(),
strangerEdges.size(), studyGEdges.size()
};
String[] edgeTypeNames = {"Friend", "Familiar Stranger", "Classmate", "Stranger", "Study Group"};
String[] edgeTypeColors = {"#4CAF50", "#2196F3", "#FF9800", "#F44336", "#9C27B0"};
java.util.List<String> typeCodes = EdgeTypeRegistry.getAllTypeCodes();
String[] edgeTypeNames = new String[typeCodes.size()];
String[] edgeTypeColors = new String[typeCodes.size()];
for (int i = 0; i < typeCodes.size(); i++) {
edgeTypeNames[i] = EdgeTypeRegistry.getName(typeCodes.get(i));
edgeTypeColors[i] = EdgeTypeRegistry.getHexColor(typeCodes.get(i));
}
int totalEdgeTypes = 0;
for (int c : edgeTypeCounts) totalEdgeTypes += c;

Expand Down
20 changes: 6 additions & 14 deletions Gvisual/src/gvisual/SvgExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,14 @@ public class SvgExporter {
private boolean colorByEdgeType = true;
private int layoutIterations = 300;

private static final Map<String, String> TYPE_COLORS = new LinkedHashMap<>();
static {
TYPE_COLORS.put("f", "#4CAF50"); // Friend — green
TYPE_COLORS.put("fs", "#2196F3"); // Familiar Stranger — blue
TYPE_COLORS.put("c", "#FF9800"); // Classmate — orange
TYPE_COLORS.put("s", "#F44336"); // Stranger — red
TYPE_COLORS.put("sg", "#9C27B0"); // Study Group — purple
}
private static final Map<String, String> TYPE_COLORS = EdgeTypeRegistry.getAllHexColors();

private static final Map<String, String> TYPE_NAMES = new LinkedHashMap<>();
private static final Map<String, String> TYPE_NAMES;
static {
TYPE_NAMES.put("f", "Friend");
TYPE_NAMES.put("fs", "Familiar Stranger");
TYPE_NAMES.put("c", "Classmate");
TYPE_NAMES.put("s", "Stranger");
TYPE_NAMES.put("sg", "Study Group");
TYPE_NAMES = new LinkedHashMap<>();
for (String code : EdgeTypeRegistry.getAllTypeCodes()) {
TYPE_NAMES.put(code, EdgeTypeRegistry.getName(code));
}
}

private final Map<String, String> customColors = new LinkedHashMap<>();
Expand Down
Loading