Skip to content

Commit

Permalink
changing methods to getter (#1251)
Browse files Browse the repository at this point in the history
* changing methods to getter

* made methods into getters

* fixed tests

* revert collect method

* fix test

* fix tests

* fix test

* reverted methods and changed function names

* updated notebook

* fix cargo tests

* refactored

* fix benchmark

* update vertices

* formatted

* Fixed reddit example

* Fixed vertices

* fix for vertices

---------

Co-authored-by: miratepuffin <b.a.steer@qmul.ac.uk>
  • Loading branch information
rachchan and miratepuffin authored Sep 15, 2023
1 parent 514c68e commit 1435891
Show file tree
Hide file tree
Showing 45 changed files with 671 additions and 480 deletions.
4 changes: 2 additions & 2 deletions comparison-benchmark/rust/raphtory-rust-benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ fn main() {
if debug {
println!(
"Graph has {} vertices and {} edges",
g.num_vertices(),
g.num_edges()
g.count_vertices(),
g.count_edges()
)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-algorithm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Algorithm for DummyAlgorithm {
) -> FieldResult<Option<FieldValue<'a>>> {
let mandatory_arg = ctx.args.try_get("mandatoryArg")?.u64()?;
let optional_arg = ctx.args.get("optionalArg").map(|v| v.u64()).transpose()?;
let num_vertices = graph.num_vertices();
let num_vertices = graph.count_vertices();
let output = Self {
number_of_nodes: num_vertices,
message: format!("mandatory arg: '{mandatory_arg}', optional arg: '{optional_arg:?}'"),
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_python_extension/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use pyo3::prelude::*;
use raphtory::{db::api::view::internal::DynamicGraph, prelude::GraphViewOps};

fn custom_algorithm<G: GraphViewOps>(graph: &G) -> usize {
graph.num_vertices()
graph.count_vertices()
}

#[pyfunction(name = "custom_algorithm")]
Expand Down
8 changes: 4 additions & 4 deletions examples/py/math_overflow/mo_investigate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
"views = g.expanding(step = 86400)\n",
"timestamps = [dt.datetime.fromtimestamp(v.latest_time()) for v in views]\n",
"\n",
"aggr_vertices = [v.num_vertices() for v in views]\n",
"aggr_vertices = [v.count_vertices() for v in views]\n",
"\n",
"agg_window = np.zeros(len(timestamps),dtype=int)\n",
"df = pd.DataFrame({\"time\": timestamps, \"window\":agg_window, \"vertices\": aggr_vertices})\n",
Expand All @@ -318,7 +318,7 @@
" diff_size = int(window_sizes[i]/86400)\n",
"\n",
" timestamps = [dt.datetime.fromtimestamp(v.latest_time()) for v in views]\n",
" vertices = [v.num_vertices() for v in views]\n",
" vertices = [v.count_vertices() for v in views]\n",
"\n",
" to_join = pd.DataFrame({\"time\": timestamps, \"window\":[window_sizes[i] for k in range(len(timestamps))], \"vertices\": vertices})\n",
" df = pd.concat([df,to_join],copy=False)\n",
Expand Down Expand Up @@ -402,7 +402,7 @@
" sx_shuffled = shuffle_column(sx_df,col_number=2)\n",
" g_shuff = load_pandas(sx_shuffled)\n",
" views = g_shuff.rolling(window=window_sizes[i],step=86400)\n",
" results_vertices[ex,:] = np.array([v.num_vertices() for v in views])\n",
" results_vertices[ex,:] = np.array([v.count_vertices() for v in views])\n",
" df.loc[df['window'] == w, 'vert_shuffled_mean'] = results_vertices.mean(axis=0)\n",
" df.loc[df['window'] == w, 'vert_shuffled_sd'] = results_vertices.std(axis=0)"
]
Expand Down Expand Up @@ -455,7 +455,7 @@
"outputs": [],
"source": [
"views = g.rolling(window=3600, step=3600)\n",
"hour_vertices = [v.num_vertices() for v in views]"
"hour_vertices = [v.count_vertices() for v in views]"
]
},
{
Expand Down
Loading

0 comments on commit 1435891

Please sign in to comment.