Skip to content

Commit 6b760de

Browse files
committed
trying to fix the docs.rs build :D
1 parent dfcaf9f commit 6b760de

3 files changed

Lines changed: 37 additions & 16 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ categories = ["algorithms", "database", "mathematics", "science"]
1515
duckdb = { version = "0.7.1" }
1616
polars = { version = "0.28.0", features = ["lazy"] }
1717

18+
[dev-dependencies]
19+
duckdb = { version = "0.7.1", features = ["bundled"] }
20+
1821
[package.metadata.docs.rs]
1922
features = []
2023
all-features = false

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ https://www.rust-lang.org/tools/install
4848
project using the Cargo package manager, which is included with Rust. You can
4949
create a new project by running the following command in your terminal:
5050

51-
```ignore
51+
```sh
5252
cargo new my_pregel_project
5353
```
5454

5555
3. _Add `pregel-rs` as a dependency_: Next, you need to add `pregel-rs` as a
5656
dependency in your `Cargo.toml` file, which is located in the root directory
5757
of your project. You can add the following line to your `Cargo.toml` file:
5858

59-
```ignore
59+
```toml
6060
[dependencies]
6161
pregel-rs = "0.0.1"
6262
```
@@ -69,13 +69,13 @@ functions and use the graph abstraction provided by `pregel-rs` to manipulate th
6969
can build and run your project using the Cargo package manager. You can build your
7070
project by running the following command in your terminal:
7171

72-
```ignore
72+
```sh
7373
cargo build
7474
```
7575

7676
And you can run your project by running the following command:
7777

78-
```ignore
78+
```sh
7979
cargo run
8080
```
8181

src/pregel.rs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,36 @@ impl PregelBuilder {
322322
///
323323
/// # Examples
324324
///
325-
/// ```ignore
326-
/// let vertices = ...
327-
/// let edges = ...
328-
///
329-
/// let pregel = PregelBuilder::new(GraphFrame::new(vertices, edges)?)
330-
/// .max_iterations(4)
331-
/// .with_vertex_column(Custom("max_value".to_owned()))
332-
/// .initial_message(col(Custom("value".to_owned()).as_ref()))
333-
/// .send_messages(MessageReceiver::Dst, Pregel::src(Custom("max_value".to_owned())))
334-
/// .aggregate_messages(Pregel::msg(None).max())
335-
/// .v_prog(max_exprs([col(Custom("max_value".to_owned()).as_ref()), Pregel::msg(None)]))
336-
/// .build();
325+
/// ```rust
326+
/// use polars::prelude::*;
327+
/// use pregel_rs::graph_frame::GraphFrame;
328+
/// use pregel_rs::pregel::ColumnIdentifier::{Custom, Dst, Id, Src};
329+
/// use pregel_rs::pregel::{MessageReceiver, Pregel, PregelBuilder};
330+
/// use std::error::Error;
331+
///
332+
/// // Simple example of a Pregel algorithm that finds the maximum value in a graph.
333+
/// fn main() -> Result<(), Box<dyn Error>> {
334+
/// let edges = df![
335+
/// Src.as_ref() => [0, 1, 1, 2, 2, 3],
336+
/// Dst.as_ref() => [1, 0, 3, 1, 3, 2],
337+
/// ]?;
338+
///
339+
/// let vertices = df![
340+
/// Id.as_ref() => [0, 1, 2, 3],
341+
/// Custom("value".to_owned()).as_ref() => [3, 6, 2, 1],
342+
/// ]?;
343+
///
344+
/// let pregel = PregelBuilder::new(GraphFrame::new(vertices, edges)?)
345+
/// .max_iterations(4)
346+
/// .with_vertex_column(Custom("max_value".to_owned()))
347+
/// .initial_message(col(Custom("value".to_owned()).as_ref()))
348+
/// .send_messages(MessageReceiver::Dst, Pregel::src(Custom("max_value".to_owned())))
349+
/// .aggregate_messages(Pregel::msg(None).max())
350+
/// .v_prog(max_exprs([col(Custom("max_value".to_owned()).as_ref()), Pregel::msg(None)]))
351+
/// .build();
352+
///
353+
/// Ok(println!("{}", pregel.run()?))
354+
/// }
337355
/// ```
338356
///
339357
/// Returns:

0 commit comments

Comments
 (0)