read_json_format

Function read_json_format 

Source
pub fn read_json_format<N, E, P>(path: P, weighted: bool) -> Result<Graph<N, E>>
where N: Node + Debug + FromStr + Clone, E: EdgeWeight + Copy + Debug + Default + FromStr, P: AsRef<Path>,
Expand description

Read an undirected graph from JSON format

§Arguments

  • path - Path to the input file
  • weighted - Whether to parse edge weights from the JSON

§Returns

  • Ok(Graph) - The graph read from the file
  • Err(GraphError) - If there was an error reading or parsing the file

§Format

The JSON format supports:

  • Node declarations with optional labels and data
  • Edge declarations with optional weights, labels, and data
  • Graph metadata and directedness specification
  • Flexible attribute storage for future extensions