Program Listing for File edges.h

Return to documentation for file (/home/docs/checkouts/readthedocs.org/user_builds/libsonata-test/checkouts/latest/include/bbp/sonata/edges.h)

/*************************************************************************
 * Copyright (C) 2018-2020 Blue Brain Project
 *
 * This file is part of 'libsonata', distributed under the terms
 * of the GNU Lesser General Public License version 3.
 *
 * See top-level COPYING.LESSER and COPYING files for details.
 *************************************************************************/

#pragma once

#include "common.h"
#include "population.h"

#include <string>
#include <vector>


namespace bbp {
namespace sonata {

//--------------------------------------------------------------------------------------------------

class SONATA_API EdgePopulation: public Population
{
  public:
    constexpr static const char* ELEMENT = "edge";

    EdgePopulation(const std::string& h5FilePath,
                   const std::string& csvFilePath,
                   const std::string& name);

    std::string source() const;

    std::string target() const;

    std::vector<NodeID> sourceNodeIDs(const Selection& selection) const;

    std::vector<NodeID> targetNodeIDs(const Selection& selection) const;

    Selection afferentEdges(const std::vector<NodeID>& target) const;

    Selection efferentEdges(const std::vector<NodeID>& source) const;

    Selection connectingEdges(const std::vector<NodeID>& source,
                              const std::vector<NodeID>& target) const;

    static void writeIndices(const std::string& h5FilePath,
                             const std::string& population,
                             uint64_t sourceNodeCount,
                             uint64_t targetNodeCount,
                             bool overwrite = false);
};

//--------------------------------------------------------------------------------------------------

using EdgeStorage = PopulationStorage<EdgePopulation>;

//--------------------------------------------------------------------------------------------------

}  // namespace sonata
}  // namespace bbp