Graphlib is a C++ library that empowers users to create and edit graphs!
If you want to contribute to GRAPHLIB, check out the CONTRIBUTING.md file!
If this product helped you, please leave a star! If it doesn't, tell me whats wrong, I respond to issues within 1-3 days!
DISCLAIMER: If this is a fork, the main repository is github.com/randomfnp/graphlib come check it out!
Switched license from AGPL v3 to Apache 2.0
Here I will post some of the best first issues I see and its status
- #2 -- Inefficiencies
For most applications, #include "graphlib.hpp" will suffice.
Example usage: g++ program.cpp -I graphlib/include/ -I graphlib/detail/ -o program, make sure to include graphlib/include/ and graphlib/detail/
NOTE: This is a C++ 20 (but soon to be 23) library and will not function if you are on too old of a g++ compiler, we recommend g++ 12 as a minimum
Example usage: clang++ program.cpp -I graphlib/include/ -I ./graphlib/detail/ -o program, make sure to include graphlib/include/ and graphlib/detail/
NOTE: This is C++ 20 (but soon to be 23) library and will not function if you are on too old of a clang compiler, we recommend clang 14 as a minimum
Example usage: cl.exe /EHsc program.cpp /Fe:program.exe
NOTE: This is a C++ 20 (but soon to be 23) library and will not function if you are using too old of an MVSC compile, we recommend MSVC 19.44 as a minimum
- node: AnyType
- weight: int/float
create_graph() creates the initial graph containing the first node vector node pairs.
graphlib::create_graph(std::unordered_map<node, std::vector<std::pair<node, weight>>> graph, std::string output_file)
The weighted version of create_graph() creates the initial graph containing the first node vector node weight pairs.
add_nodes() appends graph to the end of a file.
void add_edge(std::vector<node> new_value, node key, std::unordered_map<node, std::vector<node>> graph, std::string input_file)
The in-memory version of add_edge() takes all the normal arguments but the graph is taken as an argument as well.
graphlib::add_nodes(std::unordered_map<node, std::vector<std::pair<node, weight> graph, std::string input_file)
The weighted version of add_nodes() appends graph to the end of a file.
void add_edge(std::vector<std::pair<node, weights>> new_value, node key, std::unordered_map<node, std::vector<std::pair<node, weights>>> graph, std::string input_file)
The in-memory and weighted version of add_edge() takes all the normal arguments but the graph is taken as an argument as well.
delete_instances() removes all instances of node_to_delete from the file.
The weighted version of delete_instances() removes all instances of node_to_delete and its weight from the file.
add_edge() appends the vector of nodes to the vector at location key and then writes it to the file.
The weighted version of add_edge() appends the vector of nodes to the vector at location key and then writes it to the file.
parse() opens a file and returns a std::unordered_map<node, std::vector>.
parse<type, weight>() opens a file with weights and returns a std::unordered_map<node, std::vector<std::pair<node, weight>>>.
print_graph() prints out the contents of a file.
bfs_algorithm() runs BFS starting from starting_node to the end of the file.
The in-memory version of bfs_algorithm() runs BFS but takes the graph as an argument instead of the input file
dfs_algorithm() runs DFS starting from starting_node to the end of the file.
The in-memory version of dfs_algorithm() runs DFS but takes the graph as an argument instead of the input file
dijkstras_algorithm() runs Dijkstra's algorithm from starting_node to the end of the file.
dijkstras_algorithm(node starting_node, std::unordered_map<node, std::vector<std::pair<node, weights>>> graph)
The in-memory version of dijkstras_algorithm() runs Dijkstra's algorithm but takes the graph as an argument instead of the input file
get_neighbors() gets the neighbors of a certain key
The weighted version of get_neighbors() gets the neighbors of a certain key