Edgy
Edgy is a set of Ecto Schema and functions for treating PostgreSQL as a graph database. You can use it with other Ecto backends but the filter by property queries will not work as they utilize the PostgreSQL jsonb operators.
Installation
If available in Hex, the package can be installed
by adding edgy to your list of dependencies in mix.exs:
def deps do
[
{:edgy, "~> 0.1.0"}
]
endMake a migration
mix ecto.gen.migration setup_edgyThen make the change function look like this:
def change do
Edgy.Migrations.run_migrations()
endConfigure the default Repo
config :edgy, repo: MyApp.RepoUsage
{:ok, graph} = Edgy.create_graph("demo")
{:ok, a} = Edgy.add_node(graph, "node", %{name: "a"})
{:ok, b} = Edgy.add_node(graph, "node", %{name: "b"})
{:ok, c} = Edgy.add_node(graph, "node", %{name: "c"})
{:ok, ab} = Edgy.add_edge(graph, "link", %{name: "a -> b", strength: "strong"}, a, b)
{:ok, bc} = Edgy.add_edge(graph, "link", %{name: "b -> c", strength: "weak"}, b, c)
Edgy.edges([a], direction: :from, recursive: true)
Edgy.edges([a], properties: %{strength: "strong"})
Edgy.edges([a], properties: %{strength: "weak"})**TODO: Add description**Once published, the docs can be found at https://hexdocs.pm/edgy.