Skip to content

Commit 2efb699

Browse files
committed
feat: update DependencyGraphGenerator to enhance edge and node styling for improved visualization
1 parent 5d26aa7 commit 2efb699

3 files changed

Lines changed: 246 additions & 242 deletions

File tree

CodeLineCounter/Services/DependencyGraphGenerator.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ private static DotEdge CreateEdge(DependencyRelation dep)
6464

6565
edge.From = dotIdentifierFrom;
6666
edge.To = dotIdentifierTo;
67+
edge.Style = DotEdgeStyle.Bold;
6768
return edge;
6869
}
6970

@@ -73,7 +74,8 @@ private static DotSubgraph CreateCluster(KeyValuePair<string, List<string>> nsGr
7374
cluster.WithLabel($"cluster_{nsGroup.Key.Replace(".", "_")}");
7475
cluster.WithIdentifier($"cluster_{nsGroup.Key.Replace(".", "_")}", true);
7576
cluster.Label = nsGroup.Key;
76-
cluster.Style = DotSubgraphStyle.Filled;
77+
cluster.Style = DotSubgraphStyle.Dashed;
78+
7779
return cluster;
7880
}
7981

@@ -83,17 +85,18 @@ private static DotNode CreateNode(Dictionary<string, (int incoming, int outgoing
8385
var node = new DotNode();
8486
node.WithIdentifier(vertex, true);
8587
node.Label = $"{vertex}" +Environment.NewLine + $"\nIn: {info.incoming}, Out: {info.outgoing}";
86-
node.Shape = DotNodeShape.Box;
88+
node.Shape = DotNodeShape.Oval;
89+
node.WithPenWidth(2);
8790

8891
// Color nodes based on degrees
8992
if (info.incoming > info.outgoing)
9093
{
91-
node.FillColor = DotColor.LightGreen;
94+
node.FillColor = DotColor.MediumSeaGreen;
9295
node.Style = DotNodeStyle.Filled;
9396
}
9497
else if (info.incoming < info.outgoing)
9598
{
96-
node.FillColor = DotColor.LightSalmon;
99+
node.FillColor = DotColor.Salmon;
97100
node.Style = DotNodeStyle.Filled;
98101
}
99102

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ Code Hash,FilePath,MethodName,StartLine,NbLines
161161

162162
![Graphviz](./assets/graphviz.svg)
163163

164-
This graph is generated in the current directory with the name `<SolutionName>-Dependencies.dot`. Y
164+
This graph is generated in the current directory with the name `<SolutionName>-Dependencies.dot`.
165+
You can open it with Graphviz or any other tool that supports the .dot format.
165166

166167
## Project Structure
167168

0 commit comments

Comments
 (0)