<commit_before>#ifndef __GRAPH_H__
#define __GRAPH_H__

#include <string>

#include "vertex_index.h"
#include "vertex.h"

class undirected_graph
{
	std::vector<in_mem_undirected_vertex> vertices;

	static undirected_graph *create(edge edges[], size_t num_edges);
public:
	static undirected_graph *load_edge_list(const std::string &file);
	static undirected_graph *load_edge_list_text(const std::string &file);
	static undirected_graph *load_adjacency_list(const std::string &file);
	static void destroy(undirected_graph *g) {
		delete g;
	}

	void add_vertex(const in_mem_undirected_vertex &v) {
		vertices.push_back(v);
	}

	vertex_index *create_vertex_index() const;
	void dump(const std::string &file) const;

	size_t get_num_edges() const;
	size_t get_num_vertices() const {
		return vertices.size();
	}
	size_t get_num_non_empty_vertices() const;
};

class directed_graph
{
	std::vector<in_mem_directed_vertex> vertices;

	static directed_graph *create(edge edges[], size_t num_edges);
public:
	static directed_graph *load_edge_list(const std::string &file);
	static directed_graph *load_edge_list_text(const std::string &file);
	static directed_graph *load_adjacency_list(const std::string &file);
	static void destroy(directed_graph *g) {
		delete g;
	}

	void add_vertex(const in_mem_directed_vertex &v) {
		vertices.push_back(v);
	}

	vertex_index *create_vertex_index() const;
	void dump(const std::string &file) const;

	size_t get_num_in_edges() const;
	size_t get_num_out_edges() const;
	size_t get_num_vertices() const {
		return vertices.size();
	}
	size_t get_num_non_empty_vertices() const;
};

#endif<commit_msg>[Graph]: The vertex location in the vertex list is defined by vertex id.<commit_after>#ifndef __GRAPH_H__
#define __GRAPH_H__

#include <string>

#include "vertex_index.h"
#include "vertex.h"

class undirected_graph
{
	std::vector<in_mem_undirected_vertex> vertices;

	static undirected_graph *create(edge edges[], size_t num_edges);
public:
	static undirected_graph *load_edge_list(const std::string &file);
	static undirected_graph *load_edge_list_text(const std::string &file);
	static undirected_graph *load_adjacency_list(const std::string &file);
	static void destroy(undirected_graph *g) {
		delete g;
	}

	void add_vertex(const in_mem_undirected_vertex &v) {
		vertices.push_back(v);
	}

	vertex_index *create_vertex_index() const;
	void dump(const std::string &file) const;

	size_t get_num_edges() const;
	size_t get_num_vertices() const {
		return vertices.size();
	}
	size_t get_num_non_empty_vertices() const;
};

class directed_graph
{
	std::vector<in_mem_directed_vertex> vertices;

	static directed_graph *create(edge edges[], size_t num_edges);
public:
	static directed_graph *load_edge_list(const std::string &file);
	static directed_graph *load_edge_list_text(const std::string &file);
	static directed_graph *load_adjacency_list(const std::string &file);
	static void destroy(directed_graph *g) {
		delete g;
	}

	void add_vertex(const in_mem_directed_vertex &v) {
		assert(vertices.size() == v.get_id());
		vertices.push_back(v);
	}

	vertex_index *create_vertex_index() const;
	void dump(const std::string &file) const;

	size_t get_num_in_edges() const;
	size_t get_num_out_edges() const;
	size_t get_num_vertices() const {
		return vertices.size();
	}
	size_t get_num_non_empty_vertices() const;
};

#endif
{'fraction_non_alphanumeric': 0.10684523809523809, 'fraction_numerical': 0.0, 'mean_word_length': 6.871194379391101, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5643060', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1185, 'n_words': 265}