network-graph-filtering-by-hierarchy
Summary
Filter multi-type network edges by selecting a single representative edge per node pair according to a fixed priority hierarchy. This skill resolves ambiguity when metabolomic or other biological data contain multiple edge types (e.g., Biochemical, Structural, Mass Spectral, Correlation) between the same nodes, retaining only the highest-priority edge type for each pair.
When to use
Your network contains multiple edge types between the same pair of nodes and you need a deterministic, single-edge representation per node pair. This is especially relevant in metabolomic network analysis where correlations, biochemical relationships, structural similarities, and mass spectral matches may all be computed between the same metabolite pairs, and you wish to avoid redundancy or conflation of evidence types.
When NOT to use
- Your analysis goal requires retention of all edge types (e.g., comparative or exploratory analysis of multiple evidence types).
- Your network contains only a single edge type; filtering by hierarchy has no effect.
- The priority hierarchy does not align with your scientific priorities (e.g., you prioritize Mass Spectral over Biochemical evidence).
Inputs
- network graph with multiple edge types (Biochemical, Structural, Mass Spectral, Correlation)
- node-pair grouping or adjacency structure
- edge type labels and priority hierarchy specification
Outputs
- filtered network graph with one edge per node pair
- cytoscape.js-compatible JSON network representation
How to apply
Load the network with all computed edge types (Biochemical, Structural, Mass Spectral, Correlation) intact. Group edges by their source–target node pair. For each pair containing multiple edges, apply the fixed priority hierarchy—Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest)—and select exactly one edge per pair according to this rank. Discard all other edges for that pair. Construct the filtered network retaining only the single selected edge per node pair. Export in a cytoscape.js-compatible JSON format for visualization and downstream analysis.
Related tools
- MetaMapR (network construction and filtering engine; applies unique-edges checkbox option to enforce hierarchy-based edge selection) — https://github.com/dgrapov/MetaMapR
- cytoscape.js (JSON-based network format target for visualization and export of filtered network)
Evaluation signals
- For each source–target node pair present in the input, verify exactly one edge exists in the output.
- Verify that the retained edge is the highest-priority type present for that pair according to the hierarchy Biochemical > Structural > Mass Spectral > Correlation.
- Confirm all output edges conform to cytoscape.js JSON schema (valid node references, edge type labels).
- Check that no edges of lower priority remain when a higher-priority edge exists for the same pair.
- Validate that the edge count in the output is ≤ the edge count in the input, with equality only if input contained at most one edge per pair.
Limitations
- The priority hierarchy is fixed (Biochemical > Structural > Mass Spectral > Correlation) and cannot be customized per analysis; users with different evidence priorities must implement custom logic.
- Filtering discards all but one edge per pair; information from lower-priority edge types is permanently lost.
- Partial correlations are not yet implemented in MetaMapR, limiting the edge types available for filtering.
- The skill assumes edge types are explicitly labeled in the input; unlabeled or ambiguous edge types may cause incorrect filtering.
Evidence
- [other] When the unique edges checkbox is enabled, MetaMapR returns a single edge per node pair selected according to a fixed priority hierarchy: Biochemical edges are preferred over Structural, which are preferred over Mass Spectral, which are preferred over Correlation edges.: "When the unique edges checkbox is enabled, MetaMapR returns a single edge per node pair selected according to a fixed priority hierarchy: Biochemical edges are preferred over Structural, which are"
- [other] For each node pair with multiple edges, select the single edge with the highest priority according to the hierarchy: Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest).: "For each node pair with multiple edges, select the single edge with the highest priority according to the hierarchy: Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest)."
- [readme] The default setting for returning all edge types or only unique edges can be found under the network tab using the unique edges checkbox. If the option is selected then edges are returned based on a hierarchy Biochemical > Structural > Mass Spectral > Correlation, otherwise all edges are returned.: "If the option is selected then edges are returned based on a hierarchy Biochemical > Structural > Mass Spectral > Correlation, otherwise all edges are returned."
- [other] Construct the filtered network retaining only the selected edges per pair. Export the filtered network in a cytoscape.js-compatible format (JSON).: "Construct the filtered network retaining only the selected edges per pair. Export the filtered network in a cytoscape.js-compatible format (JSON)."
1---2name: network-graph-filtering-by-hierarchy3description: Use when your network contains multiple edge types between the same pair of nodes and you need a deterministic, single-edge representation per node pair.4license: CC-BY-4.05---67# network-graph-filtering-by-hierarchy89## Summary1011Filter multi-type network edges by selecting a single representative edge per node pair according to a fixed priority hierarchy. This skill resolves ambiguity when metabolomic or other biological data contain multiple edge types (e.g., Biochemical, Structural, Mass Spectral, Correlation) between the same nodes, retaining only the highest-priority edge type for each pair.1213## When to use1415Your network contains multiple edge types between the same pair of nodes and you need a deterministic, single-edge representation per node pair. This is especially relevant in metabolomic network analysis where correlations, biochemical relationships, structural similarities, and mass spectral matches may all be computed between the same metabolite pairs, and you wish to avoid redundancy or conflation of evidence types.1617## When NOT to use1819- Your analysis goal requires retention of all edge types (e.g., comparative or exploratory analysis of multiple evidence types).20- Your network contains only a single edge type; filtering by hierarchy has no effect.21- The priority hierarchy does not align with your scientific priorities (e.g., you prioritize Mass Spectral over Biochemical evidence).2223## Inputs2425- network graph with multiple edge types (Biochemical, Structural, Mass Spectral, Correlation)26- node-pair grouping or adjacency structure27- edge type labels and priority hierarchy specification2829## Outputs3031- filtered network graph with one edge per node pair32- cytoscape.js-compatible JSON network representation3334## How to apply3536Load the network with all computed edge types (Biochemical, Structural, Mass Spectral, Correlation) intact. Group edges by their source–target node pair. For each pair containing multiple edges, apply the fixed priority hierarchy—Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest)—and select exactly one edge per pair according to this rank. Discard all other edges for that pair. Construct the filtered network retaining only the single selected edge per node pair. Export in a cytoscape.js-compatible JSON format for visualization and downstream analysis.3738## Related tools3940- **MetaMapR** (network construction and filtering engine; applies unique-edges checkbox option to enforce hierarchy-based edge selection) — https://github.com/dgrapov/MetaMapR41- **cytoscape.js** (JSON-based network format target for visualization and export of filtered network)4243## Evaluation signals4445- For each source–target node pair present in the input, verify exactly one edge exists in the output.46- Verify that the retained edge is the highest-priority type present for that pair according to the hierarchy Biochemical > Structural > Mass Spectral > Correlation.47- Confirm all output edges conform to cytoscape.js JSON schema (valid node references, edge type labels).48- Check that no edges of lower priority remain when a higher-priority edge exists for the same pair.49- Validate that the edge count in the output is ≤ the edge count in the input, with equality only if input contained at most one edge per pair.5051## Limitations5253- The priority hierarchy is fixed (Biochemical > Structural > Mass Spectral > Correlation) and cannot be customized per analysis; users with different evidence priorities must implement custom logic.54- Filtering discards all but one edge per pair; information from lower-priority edge types is permanently lost.55- Partial correlations are not yet implemented in MetaMapR, limiting the edge types available for filtering.56- The skill assumes edge types are explicitly labeled in the input; unlabeled or ambiguous edge types may cause incorrect filtering.5758## Evidence5960- [other] When the unique edges checkbox is enabled, MetaMapR returns a single edge per node pair selected according to a fixed priority hierarchy: Biochemical edges are preferred over Structural, which are preferred over Mass Spectral, which are preferred over Correlation edges.: "When the unique edges checkbox is enabled, MetaMapR returns a single edge per node pair selected according to a fixed priority hierarchy: Biochemical edges are preferred over Structural, which are"61- [other] For each node pair with multiple edges, select the single edge with the highest priority according to the hierarchy: Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest).: "For each node pair with multiple edges, select the single edge with the highest priority according to the hierarchy: Biochemical (highest) > Structural > Mass Spectral > Correlation (lowest)."62- [readme] The default setting for returning all edge types or only unique edges can be found under the network tab using the unique edges checkbox. If the option is selected then edges are returned based on a hierarchy Biochemical > Structural > Mass Spectral > Correlation, otherwise all edges are returned.: "If the option is selected then edges are returned based on a hierarchy Biochemical > Structural > Mass Spectral > Correlation, otherwise all edges are returned."63- [other] Construct the filtered network retaining only the selected edges per pair. Export the filtered network in a cytoscape.js-compatible format (JSON).: "Construct the filtered network retaining only the selected edges per pair. Export the filtered network in a cytoscape.js-compatible format (JSON)."