# GraphPro for Obsidian GraphPro supercharges the native Obsidian graph view with a plethora of advanced controls, layout tools, selection enhancements, and position management features. It aims to provide a more powerful and flexible way to interact with and organize your graph. ![GraphPro Interface](doc/img.png) ## ✨ Features **Layout & Position Management:** * **Save & Restore Positions:** Save the current node positions and restore them later. * **Position History:** Access a history of saved positions via right-click on the "Restore" button. * **Automatic Restore:** Option to automatically restore the last active node positions on startup. * **Undo/Redo:** In-memory undo (Ctrl/Cmd+Z) and redo (Ctrl/Cmd+Shift+Z) for position changes. * **Align Nodes:** Align selected nodes (start, end, vertical, horizontal). * **Move & Scale Selection:** Precisely move or scale selected nodes. * **Arrange in Circle:** Arrange selected nodes in a circular pattern around the heaviest node or with defined inner/outer circles based on ID substrings. * **Unlock Positions:** Unlock the fixed positions of selected nodes. * **Snap to Grid:** Option to snap nodes to a configurable grid when dragging. * **Grid Display:** Toggle a visual grid in the background. **Selection Tools:** * **Area Selection:** Select nodes by dragging a rectangle while holding `Shift`. * Hold `Alt` + `Shift` while dragging to deselect nodes within the rectangle. * **Regex Selection:** Switch the search bar to a "node selection mode" to select nodes by a regular expression matching their ID. * **Select Related:** Select nodes connected to the current selection, up to a specified depth. * **Select Backlinks/Outgoing Links:** Expand selection to include backlinks or outgoing links of currently selected nodes. * **Selection Status Bar:** Displays count of selected nodes and statistics about common frontmatter keys (e.g., `cluster`, `namespace`, `service`) and, for single selections, backlink/outgoing link counts and property counts with quick access to side panes. **Display & Visuals:** * **Neighbor Labels:** Display labels of neighboring nodes on hover. * Customize label content using Regex or a frontmatter field. * **Node Icons:** (Experimental) Display custom icons for nodes (requires manual configuration in `iconMap`). * **Selection Highlighting:** Clearly highlights selected nodes. * **Mirrored Core Controls:** Direct access and input fields for core graph settings like text fade, node size, link size, forces, etc., directly in the GraphPro toolbars. * **Additional Toggles:** Quick toggles for arrows, tags, attachments, unresolved files, orphans. **Simulation & Force Control:** * **Run/Stop Simulation:** Manually start or stop the graph's force simulation. * **Node Weight:** Set the weight for selected nodes, influencing the force simulation. * **Fine-tune Forces:** Inputs to adjust center force, repel force, link force, and link distance. **Advanced & External Interaction:** * **GPT Prompt Generation:** Copy a JSON representation of selected nodes (positions, colors, links, key metadata) and a base prompt to the clipboard for use with AI layout tools like GPT. * **Paste Positions from Clipboard:** Update node positions from a JSON object (matching the GPT prompt format) pasted from the clipboard. **UI Enhancements:** * **Dedicated Control Panels:** Adds a top and a left-hand toolbar directly within the graph view for quick access to all features. * **Integrated Search/Selection:** Modifies the graph search bar to toggle between filtering and node selection modes. ## 🚀 How to Use Once installed, GraphPro automatically enhances any open graph view. You'll see new control panels: **1. Top Control Bar:** * ▶️ **Run simulation:** Starts the force-directed layout algorithm. * ⏹️ **Stop simulation:** Halts the layout algorithm, freezing nodes. * **T (Type icon):** Text fade threshold. * **◎ (Locate icon):** Node size. * **╱ (Slash icon):** Link thickness. * **📌 (Pin-off icon):** Unlock selected nodes' positions, allowing the simulation to move them. * **🎯 (Circle-dot icon):** Center force strength. * ↔️ **(Unfold-horizontal icon):** Repel force strength. * **⇆ (Minimize-2 icon):** Link force strength. * 📏 **(Ruler icon):** Link distance. * 🧲 **(Magnet icon):** Set weight for selected nodes (use adjacent input for value). * **(Input field for weight)** * ➕ **(Move icon):** Move selected nodes by X/Y offsets (use adjacent inputs). * ↕️ **(Move-vertical icon with input):** Vertical move offset. * ↔️ **(Move-horizontal icon with input):** Horizontal move offset. * ↔️ **(Scaling icon):** Scale selected nodes around their centroid (use adjacent input for ratio). * **(Input field for scale ratio)** * **⭕ (Circle-dot-dashed icon):** Arrange selected nodes in a circle (use adjacent input for max radius). * **(Input field for circle radius)** * **☊ (Workflow icon):** Select related nodes (use adjacent input for depth). * **(Input field for depth)** * 🔗← **(Links-coming-in icon):** Select backlinks of selected nodes. * →🔗 **(Links-going-out icon):** Select outgoing links of selected nodes. * **🖌️ (Paint-roller icon with input):** Selection highlight stroke width. **2. Left Control Bar:** * 💾 **(Save icon):** Save current node positions. A new timestamped entry is created. * ↺ **(History icon):** Restore positions from the currently selected history entry. * **Right-click:** Show a menu with all saved position histories. Select one to load. Also allows toggling "Auto restore on startup." * **‖← (Align-start-horizontal icon):** Align selected nodes to the top-most Y. * **↑‖ (Align-start-vertical icon):** Align selected nodes to the left-most X. * **↓‖ (Align-end-vertical icon):** Align selected nodes to the right-most X. * **‖→ (Align-end-horizontal icon):** Align selected nodes to the bottom-most Y. * **T□ (Type-outline icon):** Toggle display of neighbor labels on hover. * 🖼️ **(Image icon):** Toggle display of custom node icons (if configured). * 🧭 **(Navigation icon):** Toggle display of link arrows (mirrors core setting). * 🏷️ **(Tags icon):** Toggle display of tags (mirrors core setting). * 📎 **(Paperclip icon):** Toggle display of attachments (mirrors core setting). * 👻 **(Ghost icon):** Toggle "Existing files only" (mirrors core setting). * ⚪ **(Circle icon):** Toggle display of orphans (mirrors core setting). * ▦ **(Grid icon):** Toggle display of the background grid. * ↔️↕️ **(Flip-horizontal-2 icon):** Toggle "Snap to grid" for node dragging. * 🧠 **(Brain-circuit icon):** Copy GPT prompt and selected nodes' data to clipboard. * 📋 **(Clipboard-paste icon):** Update node positions from JSON in clipboard. **3. Search Bar Area (Top of Graph View):** * The standard search bar is enhanced. * **Ab (Whole-word icon):** Switch search to "Nodes Selection Mode". The input field will now accept a Regular Expression. Press Enter to select nodes whose IDs match the regex. * **♀ (Filter icon):** Switch search back to standard "Filter Mode". **4. Node Selection:** * Hold `Shift` and drag the mouse to draw a selection rectangle. * Hold `Alt` + `Shift` and drag to deselect nodes within the rectangle. * Selected nodes will be highlighted. Information about the selection appears in the Obsidian status bar at the bottom. **5. Node Dragging:** * When dragging a node, if other nodes are selected, they will be co-dragged, maintaining their relative positions. * If "Snap to Grid" is enabled, nodes will snap to the nearest grid intersection upon release. **6. Keyboard Shortcuts:** * `Ctrl/Cmd + Z`: Undo last node position change. * `Ctrl/Cmd + Shift + Z`: Redo last node position change. **7. "Advanced" Section in Core Graph Controls:** * GraphPro adds an "Advanced" section to Obsidian's native graph control panel (usually on the right). * **Label Regex:** A regex to extract a display label from the node ID for neighbor labels (e.g., `(?