Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

El rng #80

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions include/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @ingroup general_concepts
*/

#define ENABLE_EDGELIST_RANGE

#include <ranges>
#include <concepts>
#include <type_traits>
Expand All @@ -41,16 +43,16 @@
// VR Vertex Range
// VI ui,vi Vertex Iterator
// VVF Vertex Value Function: vvf(u) -> value
// VVP vvp Vertex Value Projection function vvp(x) --> vertex_descriptor<>
//
// E Edge type
// uv,vw Edge reference
// EV Edge Value (user-defined or void)
// ER Edge Range
// EI uvi,vwi Edge iterator
// EVF evf Edge Value Function: evf(uv) -> value
// EVP evp Edge Value Production function: evp(y) -> edge_descriptor<>
//
// ELR elr Edge List Range; an arbitrary range where its values can be projected to be an edge_descriptor.
// Proj proj Projection function: proj(y) -> edge_descriptor<...>, where y is the value type of an ELR

#ifndef GRAPH_HPP
# define GRAPH_HPP
Expand Down Expand Up @@ -203,6 +205,14 @@ template <class G>
concept sourced_adjacency_list =
adjacency_list<G> && sourced_edge<G, edge_t<G>> && requires(G&& g, edge_reference_t<G> uv) { edge_id(g, uv); };


# ifdef ENABLE_EDGELIST_RANGE
template <class ELR>
concept basic_edgelist_range = ranges::forward_range<ELR> && negation_v<index_adjacency_list<ELR>>;
template <class ELR>
concept edgelist_range = ranges::forward_range<ELR> && negation_v<adjacency_list<ELR>>;
# endif

//
// property concepts
//
Expand Down
40 changes: 40 additions & 0 deletions include/graph/graph_descriptors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ using copyable_vertex_t = vertex_descriptor<VId, void, VV>; // {id, value}
//
template <class VId, bool Sourced, class E, class EV>
struct edge_descriptor {
using source_id_type = VId;
using target_id_type = VId;
using edge_type = E;
using value_type = EV;

VId source_id;
VId target_id;
E edge;
Expand All @@ -49,41 +54,76 @@ struct edge_descriptor {

template <class VId, class E>
struct edge_descriptor<VId, true, E, void> {
using source_id_type = VId;
using target_id_type = VId;
using edge_type = E;
using value_type = void;

VId source_id;
VId target_id;
E edge;
};
template <class VId>
struct edge_descriptor<VId, true, void, void> {
using source_id_type = VId;
using target_id_type = VId;
using edge_type = void;
using value_type = void;

VId source_id;
VId target_id;
};
template <class VId, class EV>
struct edge_descriptor<VId, true, void, EV> {
using source_id_type = VId;
using target_id_type = VId;
using edge_type = void;
using value_type = EV;

VId source_id;
VId target_id;
EV value;
};

template <class VId, class E, class EV>
struct edge_descriptor<VId, false, E, EV> {
using source_id_type = void;
using target_id_type = VId;
using edge_type = void;
using value_type = EV;

VId target_id;
E edge;
EV value;
};
template <class VId, class E>
struct edge_descriptor<VId, false, E, void> {
using source_id_type = void;
using target_id_type = VId;
using edge_type = E;
using value_type = void;

VId target_id;
E edge;
};

template <class VId, class EV>
struct edge_descriptor<VId, false, void, EV> {
using source_id_type = void;
using target_id_type = VId;
using edge_type = void;
using value_type = EV;

VId target_id;
EV value;
};
template <class VId>
struct edge_descriptor<VId, false, void, void> {
using source_id_type = void;
using target_id_type = VId;
using edge_type = void;
using value_type = void;

VId target_id;
};

Expand Down
Loading