/** * Returns a String representation of this AdjacencyMatrix (comment etc.) together with the actual * data matrix. */ public String toString() { String s = "Matrix Name: " + this.matrixLabel + "\n"; s += "Matrix Labels: "; for (int i = 0; i < labels.size(); i++) { if (i == 0) { s += (String) labels.get(i); } else { s += ", " + (String) labels.get(i); } } s += "\nComment: " + comment; return s + "\nAvg Degree: " + getAvgDegree() + "\n" + matrix.toString(); }
/** Returns a String representation of only the actual data matrix. */ public String matrixToString() { String m = matrix.toString(); int index = m.indexOf("\n"); return m.substring(index + 1, m.length()); }