How to create MatrixGraphs with a large number of vertices?

Hello. I'm trying to use petgraph to create a graph with a large number of vertices. I'm currently trying with 1684212 and it says this -

thread 'main' panicked at 'assertion failed: node_capacity <= <Ix as IndexType>::max().index()', /home/cocoa/.cargo/registry/src/
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/
   1: core::panicking::panic_fmt
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/
   2: core::panicking::panic
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/
   3: petgraph::matrix_graph::MatrixGraph<N,E,Ty,Null,Ix>::with_capacity
             at /home/cocoa/.cargo/registry/src/
   4: mwe::main
             at ./src/
   5: core::ops::function::FnOnce::call_once
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I'm using a MatrixGraph because I need a graph type where I can add and remove vertices and edges and CSR graphs didn't have that. I want to use u64 or usize to store the number of vertices. Here is a minimal working example of my issue -

use petgraph::matrix_graph::MatrixGraph;

fn main() {
    let grpah = MatrixGraph::<i64, f64>::with_capacity(1684212);

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.