[jgrapht-users] Maximally connected component for dependencies?
Brought to you by:
barak_naveh,
perfecthash
From: <org...@io...> - 2013-12-30 20:34:12
|
'Lo. As mentioned previously, I'm using jgrapht to handle dependencies in a small programming language I'm developing. I was originally only using the library to handle module imports, but I've since moved to using the library to track dependencies between all types and terms in the language. For example: In the term graph, if a term t contains a reference to a term u, the graph contains an edge from t -> u. I'd like to use the connectivity information during code generation to exclude all unreferenced terms from the final program. Is the ConnectivityInspector the right way to handle this? Specifically, given a "top level" term t, I want all of those terms to which t refers, and the terms to which those terms refer, and so on, and so on, excluding any otherwise unreferenced terms. I think that basically means instantiating a new ConnectivityInspector for the term graph and then calling connectedSetOf(t)? Am I correct in thinking that, given that the graph is directed and acyclic, that I won't get terms that depend on t (vertices with outgoing edges to t)? If that's correct, then presumably I *would* get those terms if the graph was undirected? Apologies if these are blindingly obvious questions. I'm not all that familiar with graph algorithms. M |