forked from Pometry/Raphtory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first take for wasm * rename raphtory::graph_loader to raphtory_io::graph_loader * fix python module compilation issue * fix various tests that depend on csv add Graph is JS land * managed to add edges and vertices into raphtory from Javascript * actually push the wasm layer for graph * fix addVertex and addEdge to take either String or numbers * some sanity is revealed * attempt to return Vertex from rust when calling neighbours * neighbours finally works * break appart the various bits needed for wasm * added edges support and window * added a bit of extra logging to check why in_degree fails * added support for showing stack traces * add stuff back missed from the rebase * wasm POC works fine, next stop properties * remove the www submodule * add www as a folder not submodule * rename www to example * added properties for vertices and edges * move the benches into a separate project * setup benchmark workflor for raphtory-benchmark subproject * changes as per review * fix the docs for raphtory-io * fix the docs running the CsvLoader * Hello Raphtory in index.html
- Loading branch information
1 parent
834a42c
commit c013a96
Showing
55 changed files
with
5,334 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
bin/ | ||
pkg/ | ||
wasm-pack.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[package] | ||
name = "js-raphtory" | ||
version = "0.1.0" | ||
authors = ["Fabian Murariu <[email protected]>"] | ||
edition = "2018" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
default = ["console_error_panic_hook"] | ||
|
||
[dependencies] | ||
wasm-bindgen = "0.2.63" | ||
js-sys = "0.3" | ||
chrono = "0.4" | ||
raphtory = { path = "../raphtory" } | ||
|
||
# The `console_error_panic_hook` crate provides better debugging of panics by | ||
# logging them with `console.error`. This is great for development, but requires | ||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for | ||
# code size when deploying. | ||
console_error_panic_hook = { version = "0.1.7", optional = true } | ||
|
||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size | ||
# compared to the default allocator's ~10K. It is slower than the default | ||
# allocator, however. | ||
wee_alloc = { version = "0.4.5", optional = true } | ||
|
||
[dev-dependencies] | ||
wasm-bindgen-test = "0.3.35" | ||
|
||
[profile.release] | ||
# Tell `rustc` to optimize for small code size. | ||
opt-level = "s" | ||
|
||
[workspace] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
./bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: node_js | ||
node_js: "10" | ||
|
||
script: | ||
- ./node_modules/.bin/webpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// A dependency graph that contains any wasm must all be imported | ||
// asynchronously. This `bootstrap.js` file does the single async import, so | ||
// that no one else needs to worry about it again. | ||
import("./index.js") | ||
.catch(e => console.error("Error importing `index.js`:", e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Hello Raphtory!</title> | ||
</head> | ||
<body> | ||
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript> | ||
<script src="./bootstrap.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Graph } from "js-raphtory"; | ||
|
||
const g = new Graph(); | ||
|
||
g.addVertex(2n, "Bob"); | ||
g.addVertex(3n, "Alice"); | ||
g.addVertex(12n, "Charlie"); | ||
|
||
// both src and dst must be the same type | ||
g.addEdge(9n, "Bob", "Alice", { relation: "knows" }); | ||
|
||
const bob = g.getVertex("Bob"); | ||
const alice = g.getVertex("Alice"); | ||
|
||
function printVertex(v) { | ||
|
||
console.log( | ||
{ | ||
id: v.id(), | ||
name: v.name(), | ||
neighbours_out: v.outNeighbours(), | ||
neighbours_in: v.inNeighbours(), | ||
neighbours: v.neighbours(), | ||
inDegree: v.inDegree(), | ||
outDegree: v.outDegree(), | ||
props: v.properties(), | ||
edges: v.edges(), | ||
} | ||
); | ||
} | ||
|
||
const wg = g.window(3n, 9n); | ||
|
||
const charlie = g.getVertex("Charlie"); | ||
console.log(charlie); | ||
|
||
printVertex(charlie); | ||
printVertex(bob); | ||
printVertex(alice); |
Oops, something went wrong.