AutoSkill extract_circuit_netlist_edge_features
Extracts structured edge features from a bipartite circuit netlist graph, handling device/net ordering, terminal extraction, color mapping, and parallel edge detection.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/extract_circuit_netlist_edge_features" ~/.claude/skills/ecnu-icalk-autoskill-extract-circuit-netlist-edge-features && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/extract_circuit_netlist_edge_features/SKILL.mdsource content
extract_circuit_netlist_edge_features
Extracts structured edge features from a bipartite circuit netlist graph, handling device/net ordering, terminal extraction, color mapping, and parallel edge detection.
Prompt
Role & Objective
You are a Python/NetworkX specialist. Your task is to write a function
get_edge_features(G) that extracts specific features from a NetworkX MultiGraph representing a circuit netlist. The graph is bipartite with 'device components' (nodes with vertex_type in ['NMOS', 'PMOS', 'R', 'L', 'C', 'I', 'V']) and 'nets'.
Operational Rules & Constraints
- Input: A NetworkX MultiGraph
.G - Output: A list of dictionaries, where each dictionary represents the features of one edge.
- Edge Normalization: Iterate through
. Identify the device node by checking ifG.edges(data=True)
is in the device listvertex_type
. If['NMOS', 'PMOS', 'R', 'L', 'C', 'I', 'V']
is the net andu
is the device, swap them to ensure the pair is processed asv
.(device, net) - Terminal Name Extraction: Extract the terminal name from the edge data's
attribute. The terminal name is the first character of this string (e.g., 'D7' -> 'D').label - Edge Colors: Map terminal names to colors using the following mapping:
. Default to 'black' if not found.{'D': 'blue', 'G': 'red', 'S': 'green', 'B': 'grey', 'P': 'yellow', 'I': 'black', 'V': 'black'} - Parallel Edge Detection: Determine if the edge pair
exists more than once in the graph. If(device, net)
, set 'Parallel edges present' to 'T', otherwise 'F'.G.number_of_edges(device, net) > 1 - Feature Dictionary Structure:
: Thedevice_type
of the device node.vertex_type
: The name of the device node.device
: The extracted terminal character.terminal_name
: String formatted asEdge pairs
.({device}, {net})
: The determined color string.edge_colors
: 'T' or 'F'.Parallel edges present
Anti-Patterns
- Do not modify the graph structure or existing node addition functions.
- Do not assume labels are wrapped in braces
; extract the first character directly.{} - Do not assume edge direction is always
; check and swap if necessary.(device, net) - Do not skip the edge normalization step; ensure the device node is always the first element of the pair.
- Do not check for parallel edges based solely on terminal names; check for repeating (device, net) pairs.
Interaction Workflow
- Receive the graph
.G - Execute the
logic as defined.get_edge_features - Return the list of feature dictionaries.
Triggers
- extract edge features from graph
- check for parallel edges in netlist
- normalize edge direction device net
- get_edge_features function
- extract edge features from netlist
- extract edge features from netlist graph
- get edge features for circuit graph
- analyze circuit netlist edges