Hi Alexander,
just tested yours graph library for kotlin when seeking for topological sort in Kotlin.
Unfortunately I failed with graph with single vertex only:
val vertices = arrayOf("vertex")
val mutableGraph = mutableGraphOf<identifier, int="">(values = *vertices)
val toposort = analystOf(mutableGraph).sortTopological()</identifier,>
I was expecting the output of toposort will be set with single item "vertex", but empty set was generated.
I briefly checked your code and found you are copying the graph just by edges / you omit disconnected vertices:
protected constructor(graph: Graph<v, e="">) {
for(vertex in graph.vertexes) {
vertex.startsIn.forEach(::cloneEdge)
vertex.endsIn.forEach(::cloneEdge)
}
}</v,>
I didn't investigate deeper the purpose of this method, but IMO opinion rejecting orphaned vertices is wrong in general for any use-case.
Also I would like to ask you to extend the library by constructor of mutable graph that does not require any vertices/edges when creating new instance. I'm processing large json and gathering all vertices in advance is very inconvenient, later on I have to put edges into the same graph, it would be nice to start with an empty graph and add vertices and edges as going through the structure in single pass.
https://sourceforge.net/p/kotlin-utils/code/ci/94a01faac8da2a57a73bea7a8ddd31887f3d63b4/
0.79