diff --git a/Cargo.toml b/Cargo.toml index 655b946..962b4a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,4 @@ keywords = ["pregel", "graph", "pagerank", "polars", "algorithms"] categories = ["algorithms", "database", "mathematics", "science"] [dependencies] -polars = { version = "0.29.0", features = ["lazy", "streaming", "parquet", "performant", "chunked_ids"] } - -[package.metadata.docs.rs] -features = [] -all-features = false -no-default-features = true -default-target = "x86_64-unknown-linux-gnu" \ No newline at end of file +polars = { version = "0.30.0", features = ["lazy", "streaming", "parquet", "performant", "chunked_ids"] } \ No newline at end of file diff --git a/README.md b/README.md index ff78ed7..802648f 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ of your project. You can add the following line to your `Cargo.toml` file: ```toml [dependencies] -pregel-rs = "0.0.9" +pregel-rs = "0.0.10" ``` 4. _Implement your graph algorithm_: Now you can start implementing your graph diff --git a/examples/maximum_value.rs b/examples/maximum_value.rs index 76c2a76..91d9ae0 100644 --- a/examples/maximum_value.rs +++ b/examples/maximum_value.rs @@ -1,6 +1,6 @@ use polars::prelude::*; use pregel_rs::graph_frame::GraphFrame; -use pregel_rs::pregel::Column::{Custom, Dst, Id, Src}; +use pregel_rs::pregel::Column::{Custom, Object, Subject, VertexId}; use pregel_rs::pregel::{Column, MessageReceiver, PregelBuilder}; use std::error::Error; @@ -14,12 +14,12 @@ use std::error::Error; /// print the result of the `pregel.run()` method call to the console. fn main() -> Result<(), Box> { let edges = df![ - Src.as_ref() => [0, 1, 1, 2, 2, 3], - Dst.as_ref() => [1, 0, 3, 1, 3, 2], + Subject.as_ref() => [0, 1, 1, 2, 2, 3], + Object.as_ref() => [1, 0, 3, 1, 3, 2], ]?; let vertices = df![ - Id.as_ref() => [0, 1, 2, 3], + VertexId.as_ref() => [0, 1, 2, 3], Custom("value").as_ref() => [3, 6, 2, 1], ]?; diff --git a/examples/pagerank.rs b/examples/pagerank.rs index d5da382..d0fb769 100644 --- a/examples/pagerank.rs +++ b/examples/pagerank.rs @@ -1,6 +1,6 @@ use polars::prelude::*; use pregel_rs::graph_frame::GraphFrame; -use pregel_rs::pregel::Column::{Custom, Dst, Id, Src}; +use pregel_rs::pregel::Column::{Custom, Object, Subject, VertexId}; use pregel_rs::pregel::{Column, MessageReceiver, PregelBuilder}; use std::error::Error; @@ -13,14 +13,14 @@ use std::error::Error; /// result of the `pregel.run()` method call to the console. fn main() -> Result<(), Box> { let edges = df![ - Src.as_ref() => [0, 0, 1, 2, 3, 4, 4, 4], - Dst.as_ref() => [1, 2, 2, 3, 3, 1, 2, 3], + Subject.as_ref() => [0, 0, 1, 2, 3, 4, 4, 4], + Object.as_ref() => [1, 2, 2, 3, 3, 1, 2, 3], ]?; let vertices = GraphFrame::from_edges(edges.clone())?.out_degrees()?; let damping_factor = 0.85; - let num_vertices: f64 = vertices.column(Id.as_ref())?.len() as f64; + let num_vertices: f64 = vertices.column(VertexId.as_ref())?.len() as f64; let pregel = PregelBuilder::new(GraphFrame::new(vertices, edges)?) .max_iterations(4) diff --git a/src/graph_frame.rs b/src/graph_frame.rs index ff0882a..711d6e3 100644 --- a/src/graph_frame.rs +++ b/src/graph_frame.rs @@ -1,4 +1,4 @@ -use crate::pregel::Column::{Custom, Dst, Id, Src}; +use crate::pregel::Column::{Custom, Object, Subject, VertexId}; use polars::prelude::*; use std::fmt::{Debug, Display, Formatter}; use std::{error, fmt}; @@ -76,14 +76,14 @@ impl error::Error for GraphFrameError { #[derive(Debug)] pub enum MissingColumnError { /// `Id` is a variant of `MissingColumnError` that represents the error that - /// occurs when the `Id` column is missing from a DataFrame. - Id, + /// occurs when the `VertexId` column is missing from a DataFrame. + VertexId, /// `Src` is a variant of `MissingColumnError` that represents the error that - /// occurs when the `Src` column is missing from a DataFrame. - Src, + /// occurs when the `Subject` column is missing from a DataFrame. + Subject, /// `Dst` is a variant of `MissingColumnError` that represents the error that - /// occurs when the `Dst` column is missing from a DataFrame. - Dst, + /// occurs when the `Object` column is missing from a DataFrame. + Object, } impl Display for MissingColumnError { @@ -91,9 +91,9 @@ impl Display for MissingColumnError { let message = |df, column: &str| format!("Missing column {} in {}", column, df); match self { - MissingColumnError::Id => write!(f, "{}", message("vertices", Id.as_ref())), - MissingColumnError::Src => write!(f, "{}", message("edges", Src.as_ref())), - MissingColumnError::Dst => write!(f, "{}", message("edges", Dst.as_ref())), + MissingColumnError::VertexId => write!(f, "{}", message("vertices", VertexId.as_ref())), + MissingColumnError::Subject => write!(f, "{}", message("edges", Subject.as_ref())), + MissingColumnError::Object => write!(f, "{}", message("edges", Object.as_ref())), } } } @@ -124,14 +124,14 @@ impl GraphFrame { /// `vertices` and `edges` DataFrames. If any of the required columns (`Id`, `Src`, /// `Dst`) are missing in the DataFrames, the function returns an `Error`. pub fn new(vertices: DataFrame, edges: DataFrame) -> Result { - if !vertices.get_column_names().contains(&Id.as_ref()) { - return Err(GraphFrameError::MissingColumn(MissingColumnError::Id)); + if !vertices.get_column_names().contains(&VertexId.as_ref()) { + return Err(GraphFrameError::MissingColumn(MissingColumnError::VertexId)); } - if !edges.get_column_names().contains(&Src.as_ref()) { - return Err(GraphFrameError::MissingColumn(MissingColumnError::Src)); + if !edges.get_column_names().contains(&Subject.as_ref()) { + return Err(GraphFrameError::MissingColumn(MissingColumnError::Subject)); } - if !edges.get_column_names().contains(&Dst.as_ref()) { - return Err(GraphFrameError::MissingColumn(MissingColumnError::Dst)); + if !edges.get_column_names().contains(&Object.as_ref()) { + return Err(GraphFrameError::MissingColumn(MissingColumnError::Object)); } Ok(GraphFrame { vertices, edges }) @@ -152,17 +152,17 @@ impl GraphFrame { /// The `from_edges` function returns a `Result` where `Self` is the /// `GraphFrame` struct. pub fn from_edges(edges: DataFrame) -> Result { - let srcs = edges + let subjects = edges .clone() // this is because cloning a DataFrame is cheap .lazy() - .select([col(Src.as_ref()).alias(Id.as_ref())]); - let dsts = edges + .select([col(Subject.as_ref()).alias(VertexId.as_ref())]); + let objects = edges .clone() // this is because cloning a DataFrame is cheap .lazy() - .select([col(Dst.as_ref()).alias(Id.as_ref())]); - let vertices = concat([srcs, dsts], true, true)? + .select([col(Object.as_ref()).alias(VertexId.as_ref())]); + let vertices = concat([subjects, objects], true, true)? .unique( - Some(vec![Id.as_ref().to_string()]), + Some(vec![VertexId.as_ref().to_string()]), UniqueKeepStrategy::First, ) .collect()?; @@ -184,7 +184,7 @@ impl GraphFrame { pub fn out_degrees(self) -> PolarsResult { self.edges .lazy() - .groupby([col(Src.as_ref()).alias(Id.as_ref())]) + .groupby([col(Subject.as_ref()).alias(VertexId.as_ref())]) .agg([count().alias(Custom("out_degree").as_ref())]) .collect() } @@ -203,7 +203,7 @@ impl GraphFrame { pub fn in_degrees(self) -> PolarsResult { self.edges .lazy() - .groupby([col(Dst.as_ref())]) + .groupby([col(Object.as_ref())]) .agg([count().alias(Custom("in_degree").as_ref())]) .collect() } @@ -226,26 +226,26 @@ impl Display for GraphFrame { #[cfg(test)] mod tests { - use crate::graph_frame::GraphFrame; + use crate::graph_frame::{GraphFrame, GraphFrameError}; + use crate::pregel::Column; use polars::prelude::*; + fn graph() -> Result { + let subjects = Series::new(Column::Subject.as_ref(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + let objects = Series::new(Column::Object.as_ref(), [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]); + GraphFrame::from_edges(DataFrame::new(vec![subjects, objects]).unwrap()) + } + #[test] fn test_from_edges() { - let srcs = Series::new("src", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - let dsts = Series::new("dst", [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); - let graphframe = GraphFrame::from_edges(edges).unwrap(); - assert_eq!(graphframe.vertices.height(), 10); - assert_eq!(graphframe.edges.height(), 10); + let graph = graph().unwrap(); + assert_eq!(graph.vertices.height(), 10); + assert_eq!(graph.edges.height(), 10); } #[test] fn test_in_degree() { - let srcs = Series::new("src", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - let dsts = Series::new("dst", [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); - let graphframe = GraphFrame::from_edges(edges).unwrap(); - let in_degree = graphframe.in_degrees().unwrap(); + let in_degree = graph().unwrap().in_degrees().unwrap(); assert_eq!(in_degree.height(), 10); assert_eq!( in_degree @@ -261,11 +261,7 @@ mod tests { #[test] fn test_out_degree() { - let srcs = Series::new("src", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - let dsts = Series::new("dst", [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); - let graphframe = GraphFrame::from_edges(edges).unwrap(); - let out_degree = graphframe.out_degrees().unwrap(); + let out_degree = graph().unwrap().out_degrees().unwrap(); assert_eq!(out_degree.height(), 10); assert_eq!( out_degree @@ -280,38 +276,40 @@ mod tests { } #[test] - fn test_new_missing_id_column() { - let vertices = DataFrame::new(vec![Series::new("its_not_id", [1, 2, 3])]).unwrap(); - let srcs = Series::new("src", [1, 2, 3]); - let dsts = Series::new("dst", [2, 3, 4]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); + fn test_new_missing_vertex_id_column() { + let vertices = DataFrame::new(vec![Series::new("not_vertex_id", [1, 2, 3])]).unwrap(); + let subjects = Series::new(Column::Subject.as_ref(), [1, 2, 3]); + let objects = Series::new(Column::Object.as_ref(), [2, 3, 4]); + let edges = DataFrame::new(vec![subjects, objects]).unwrap(); match GraphFrame::new(vertices, edges) { Ok(_) => panic!("Should have failed"), - Err(e) => assert_eq!(e.to_string(), "Missing column id in vertices"), + Err(e) => assert_eq!(e.to_string(), "Missing column vertex_id in vertices"), } } #[test] - fn test_new_missing_src_column() { - let vertices = DataFrame::new(vec![Series::new("id", [1, 2, 3])]).unwrap(); - let srcs = Series::new("its_not_src", [1, 2, 3]); - let dsts = Series::new("dst", [2, 3, 4]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); + fn test_new_missing_subject_column() { + let vertices = + DataFrame::new(vec![Series::new(Column::VertexId.as_ref(), [1, 2, 3])]).unwrap(); + let subjects = Series::new("not_src", [1, 2, 3]); + let objects = Series::new(Column::Object.as_ref(), [2, 3, 4]); + let edges = DataFrame::new(vec![subjects, objects]).unwrap(); match GraphFrame::new(vertices, edges) { Ok(_) => panic!("Should have failed"), - Err(e) => assert_eq!(e.to_string(), "Missing column src in edges"), + Err(e) => assert_eq!(e.to_string(), "Missing column subject in edges"), } } #[test] - fn test_new_missing_dst_column() { - let vertices = DataFrame::new(vec![Series::new("id", [1, 2, 3])]).unwrap(); - let srcs = Series::new("src", [1, 2, 3]); - let dsts = Series::new("its_not_dst", [2, 3, 4]); - let edges = DataFrame::new(vec![srcs, dsts]).unwrap(); + fn test_new_missing_object_column() { + let vertices = + DataFrame::new(vec![Series::new(Column::VertexId.as_ref(), [1, 2, 3])]).unwrap(); + let subjects = Series::new(Column::Subject.as_ref(), [1, 2, 3]); + let objects = Series::new("not_dst", [2, 3, 4]); + let edges = DataFrame::new(vec![subjects, objects]).unwrap(); match GraphFrame::new(vertices, edges) { Ok(_) => panic!("Should have failed"), - Err(e) => assert_eq!(e.to_string(), "Missing column dst in edges"), + Err(e) => assert_eq!(e.to_string(), "Missing column object in edges"), } } } diff --git a/src/pregel.rs b/src/pregel.rs index 0ac7a26..7a53a99 100644 --- a/src/pregel.rs +++ b/src/pregel.rs @@ -9,12 +9,14 @@ type FnBox<'a> = Box Expr + 'a>; /// types of columns in a data structure or database table for it to be used /// in a Pregel program. pub enum Column { - /// The `Id` variant represents the column that contains the vertex IDs. - Id, - /// The `Src` variant represents the column that contains the source vertex IDs. - Src, - /// The `Dst` variant represents the column that contains the destination vertex IDs. - Dst, + /// The `VertexId` variant represents the column that contains the vertex IDs. + VertexId, + /// The `Subject` variant represents the column that contains the source vertex IDs. + Subject, + /// The `Predicate` variant represents the column that contains the IDs of the predicates. + Predicate, + /// The `Object` variant represents the column that contains the destination vertex IDs. + Object, /// The `Edge` variant represents the column that contains the edge IDs. Edge, /// The `Msg` variant represents the column that contains the messages sent to a vertex. @@ -36,10 +38,10 @@ pub enum Column { /// /// ```rust /// use polars::prelude::*; -/// use pregel_rs::pregel::Column::{Custom, Id}; +/// use pregel_rs::pregel::Column::{Custom, VertexId}; /// /// let vertices = df![ -/// Id.as_ref() => [0, 1, 2, 3], +/// VertexId.as_ref() => [0, 1, 2, 3], /// Custom("value").as_ref() => [3, 6, 2, 1], /// ]; /// @@ -47,9 +49,10 @@ pub enum Column { impl AsRef for Column { fn as_ref(&self) -> &str { match self { - Column::Id => "id", - Column::Src => "src", - Column::Dst => "dst", + Column::VertexId => "vertex_id", + Column::Subject => "subject", + Column::Predicate => "predicate", + Column::Object => "object", Column::Edge => "edge", Column::Msg => "msg", Column::Pregel => "_pregel_msg_", @@ -80,7 +83,7 @@ impl Column { /// `col` function and the `alias` method of the `Pregel` struct to generate the /// appropriate column name. pub fn src(column_name: Column) -> Expr { - col(&Self::alias(&Column::Src, column_name)) + col(&Self::alias(&Column::Subject, column_name)) } /// This function returns an expression for a column identifier representing @@ -100,7 +103,7 @@ impl Column { /// expression is created using the `col` function and the `alias` method of the /// `Pregel` struct to ensure that the column name is properly qualified. pub fn dst(column_name: Column) -> Expr { - col(&Self::alias(&Column::Dst, column_name)) + col(&Self::alias(&Column::Object, column_name)) } /// This function returns an expression for a column name in a graph edge table. @@ -179,8 +182,8 @@ impl<'a> SendMessage<'a> { // it will keep only the left-hand side of the joins, thus, we need to use the `src.id` and // `edge.dst` columns to get the correct vertex IDs. let message_direction = match message_direction { - MessageReceiver::Src => Column::src(Column::Id), - MessageReceiver::Dst => Column::edge(Column::Dst), + MessageReceiver::Src => Column::src(Column::VertexId), + MessageReceiver::Dst => Column::edge(Column::Object), }; let send_message = Box::new(send_message); // Now we create the `SendMessage` struct with everything set up. @@ -390,8 +393,8 @@ pub enum MessageReceiver { impl From for Column { fn from(message_receiver: MessageReceiver) -> Column { match message_receiver { - MessageReceiver::Src => Column::Src, - MessageReceiver::Dst => Column::Dst, + MessageReceiver::Src => Column::Subject, + MessageReceiver::Dst => Column::Object, } } } @@ -493,7 +496,7 @@ impl<'a> PregelBuilder<'a> { /// use polars::prelude::*; /// use pregel_rs::graph_frame::GraphFrame; /// use pregel_rs::pregel::Column; - /// use pregel_rs::pregel::Column::{Custom, Dst, Id, Src}; + /// use pregel_rs::pregel::Column::{Custom, Object, VertexId, Subject}; /// use pregel_rs::pregel::{MessageReceiver, Pregel, PregelBuilder}; /// use std::error::Error; /// @@ -503,12 +506,12 @@ impl<'a> PregelBuilder<'a> { /// fn main() -> Result<(), Box> { /// /// let edges = df![ - /// Src.as_ref() => [0, 1, 1, 2, 2, 3], - /// Dst.as_ref() => [1, 0, 3, 1, 3, 2], + /// Subject.as_ref() => [0, 1, 1, 2, 2, 3], + /// Object.as_ref() => [1, 0, 3, 1, 3, 2], /// ]?; /// /// let vertices = df![ - /// Id.as_ref() => [0, 1, 2, 3], + /// VertexId.as_ref() => [0, 1, 2, 3], /// Custom("value").as_ref() => [3, 6, 2, 1], /// ]?; /// @@ -697,19 +700,19 @@ impl<'a> PregelBuilder<'a> { /// use polars::prelude::*; /// use pregel_rs::graph_frame::GraphFrame; /// use pregel_rs::pregel::Column; - /// use pregel_rs::pregel::Column::{Custom, Dst, Id, Src}; + /// use pregel_rs::pregel::Column::{Custom, Object, VertexId, Subject}; /// use pregel_rs::pregel::{MessageReceiver, Pregel, PregelBuilder}; /// use std::error::Error; /// /// // Simple example of a Pregel algorithm that finds the maximum value in a graph. /// fn main() -> Result<(), Box> { /// let edges = df![ - /// Src.as_ref() => [0, 1, 1, 2, 2, 3], - /// Dst.as_ref() => [1, 0, 3, 1, 3, 2], + /// Subject.as_ref() => [0, 1, 1, 2, 2, 3], + /// Object.as_ref() => [1, 0, 3, 1, 3, 2], /// ]?; /// /// let vertices = df![ - /// Id.as_ref() => [0, 1, 2, 3], + /// VertexId.as_ref() => [0, 1, 2, 3], /// Custom("value").as_ref() => [3, 6, 2, 1], /// ]?; /// @@ -840,18 +843,18 @@ impl<'a> Pregel<'a> { let current_vertices_df = ¤t_vertices.lazy(); let triplets_df = current_vertices_df .to_owned() - .select([all().prefix(&format!("{}.", Column::Src.as_ref()))]) + .select([all().prefix(&format!("{}.", Column::Subject.as_ref()))]) .inner_join( edges.to_owned().select([all()]), - Column::src(Column::Id), // src column of the current_vertices DataFrame - Column::edge(Column::Src), // src column of the edges DataFrame + Column::src(Column::VertexId), // src column of the current_vertices DataFrame + Column::edge(Column::Subject), // src column of the edges DataFrame ) .inner_join( current_vertices_df .to_owned() - .select([all().prefix(&format!("{}.", Column::Dst.as_ref()))]), - Column::edge(Column::Dst), // dst column of the resulting DataFrame - Column::dst(Column::Id), // id column of the current_vertices DataFrame + .select([all().prefix(&format!("{}.", Column::Object.as_ref()))]), + Column::edge(Column::Object), // dst column of the resulting DataFrame + Column::dst(Column::VertexId), // id column of the current_vertices DataFrame ); // We create a DataFrame that contains the messages sent by the vertices. The messages // are computed by performing an aggregation on the `triplets_df` DataFrame. The aggregation @@ -869,7 +872,7 @@ impl<'a> Pregel<'a> { ( message_direction .to_owned() - .alias(&Column::alias(&Column::Msg, Column::Id)), + .alias(&Column::alias(&Column::Msg, Column::VertexId)), send_message_expr().alias(Column::Pregel.as_ref()), ) }) @@ -880,7 +883,7 @@ impl<'a> Pregel<'a> { let aggregate_messages = &mut self.aggregate_messages; let message_df = triplets_df .select(send_messages) - .groupby([Column::msg(Some(Column::Id))]) + .groupby([Column::msg(Some(Column::VertexId))]) .agg([aggregate_messages().alias(Column::Pregel.as_ref())]); // We Compute the new values for the vertices. Note that we have to check for possibly // null values after performing the outer join. This is, columns where the join key does @@ -892,12 +895,12 @@ impl<'a> Pregel<'a> { .to_owned() .outer_join( message_df, - col(Column::Id.as_ref()), // id column of the current_vertices DataFrame - Column::msg(Some(Column::Id)), // msg.id column of the message_df DataFrame + col(Column::VertexId.as_ref()), // id column of the current_vertices DataFrame + Column::msg(Some(Column::VertexId)), // msg.id column of the message_df DataFrame ) .with_column(Column::msg(None).fill_null(self.replace_nulls.to_owned())) .select(&[ - col(Column::Id.as_ref()), + col(Column::VertexId.as_ref()), v_prog().alias(self.vertex_column.as_ref()), ]); // We update the `current_vertices` DataFrame with the new values for the vertices. We @@ -908,8 +911,8 @@ impl<'a> Pregel<'a> { .to_owned() .inner_join( vertex_columns, - col(Column::Id.as_ref()), - col(Column::Id.as_ref()), + col(Column::VertexId.as_ref()), + col(Column::VertexId.as_ref()), ) .with_common_subplan_elimination(false) .with_streaming(true) @@ -925,14 +928,15 @@ impl<'a> Pregel<'a> { #[cfg(test)] mod tests { use crate::graph_frame::GraphFrame; + use crate::pregel::Column::VertexId; use crate::pregel::{Column, MessageReceiver, Pregel, PregelBuilder, SendMessage}; use polars::prelude::*; use std::error::Error; fn pagerank_graph() -> Result { let edges = match df![ - Column::Src.as_ref() => [0, 0, 1, 2, 3, 4, 4, 4], - Column::Dst.as_ref() => [1, 2, 2, 3, 3, 1, 2, 3], + Column::Subject.as_ref() => [0, 0, 1, 2, 3, 4, 4, 4], + Column::Object.as_ref() => [1, 2, 2, 3, 3, 1, 2, 3], ] { Ok(edges) => edges, Err(_) => return Err(String::from("Error creating the edges DataFrame")), @@ -961,7 +965,7 @@ mod tests { fn pagerank_builder<'a>(iterations: u8) -> Result, Box> { let graph = pagerank_graph()?; let damping_factor = 0.85; - let num_vertices: f64 = graph.vertices.column(Column::Id.as_ref())?.len() as f64; + let num_vertices: f64 = graph.vertices.column(Column::VertexId.as_ref())?.len() as f64; Ok(PregelBuilder::new(graph) .max_iterations(iterations) @@ -1037,15 +1041,15 @@ mod tests { fn max_value_graph() -> Result { let edges = match df![ - Column::Src.as_ref() => [0, 1, 1, 2, 2, 3], - Column::Dst.as_ref() => [1, 0, 3, 1, 3, 2], + Column::Subject.as_ref() => [0, 1, 1, 2, 2, 3], + Column::Object.as_ref() => [1, 0, 3, 1, 3, 2], ] { Ok(edges) => edges, Err(_) => return Err(String::from("Error creating the edges DataFrame")), }; let vertices = match df![ - Column::Id.as_ref() => [0, 1, 2, 3], + Column::VertexId.as_ref() => [0, 1, 2, 3], Column::Custom("value").as_ref() => [3, 6, 2, 1], ] { Ok(vertices) => vertices, @@ -1169,7 +1173,7 @@ mod tests { Err(_) => return Err(String::from("Error running pregel")), }; - let sorted_pregel = match pregel.sort(&["id"], false) { + let sorted_pregel = match pregel.sort(&[VertexId.as_ref()], false) { Ok(sorted_pregel) => sorted_pregel, Err(_) => return Err(String::from("Error sorting the DataFrame")), };