Re: [jgrapht-developers] dumping adjacency and laplacian matrices
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2005-12-13 06:08:29
|
On Mon, 2005-12-12 at 14:29 -0500, Charles Fry wrote: > John already suggested placing this in org._3pq.jgrapht.ext. Perhaps it > could be called MatrixExporter? Possible static method names would be > dumpAdjacencyMatrix and dumpLaplacianMatrix, but I'd love to hear other > ideas. MatrixExporter sounds good. A pattern you might consider instead of static methods is to support "knob" methods for tweaking the formatting before the export, e.g. String generateMatrixWithBrackets(Graph g) { MatrixExporter exporter = new MatrixExporter(); StringWriter sw = new StringWriter(); exporter.setBrackets("[","]"); exporter.exportAdjacencyMatrix(sw, g); return sw.toString(); } Just a made-up example for an exporter which supports bracket customizatoin. JVS |