CP Graph Visualizer

Instantly visualize graph data structures directly inside Visual Studio Code. Designed specifically for competitive programmers, this extension eliminates the need to manually draw graphs on paper when debugging complex graph algorithms.
Features
- Instant Rendering: Paste your raw test case input and instantly generate an interactive, draggable graph in a new editor tab.
- Multiple Input Formats:
- Plain Text: Standard
u v edge lists common in competitive programming problems.
- Array (Edge List): JSON-style arrays of edges, e.g.,
[[0, 1], [1, 2]].
- Array (Adjacency List): JSON-style arrays where the index represents the node, e.g.,
[[1, 2], [2], []].
- Directed & Undirected Graphs: Toggle edge arrows with a single click.
- Weighted Edge Support: Seamlessly parse and display edge weights (e.g.,
u v w or [u, v, w]).
- Dynamic Indexing: Switch between
0-indexed and 1-indexed nodes to perfectly match your problem statement.
- Interactive Debugging: Click on any node to instantly highlight all connected edges in bold red while dimming the rest of the graph, making it easy to trace paths in dense networks.
Usage
- Open the Command Palette or click the Graph Visualizer icon in the Activity Bar to open the sidebar.
- Select your graph configurations (Directed/Undirected, Weighted, Start Index).
- Paste your graph data into the input box.
- Click Submit.
1. Plain Text (Edge List)
6 9
1 2
1 5
5 2
4 3
2. Array (Weighted Edge List)
[
[1, 2, 10],
[1, 5, 20],
[5, 2, 50]
]
3. Array (Adjacency List - 0 Indexed)
[[1, 2], [2], []]
(Meaning: Node 0 connects to 1 and 2. Node 1 connects to 2. Node 2 has no outgoing edges).
Extension Settings
This extension contributes a dedicated view to the Activity Bar, allowing you to keep your code open in the main editor while configuring your graph inputs on the side.
Release Notes
0.0.1
- Initial release of CP Graph Visualizer.
- Support for Plain Text and Array inputs.
- Interactive node highlighting and physics-based layout using Vis-Network.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request to the GitHub Repository. For major changes, please open an issue first to discuss what you would like to change. Make sure to update tests as appropriate.
License
This project is licensed under the MIT License - see the LICENSE file for details.