<commit_before>class ProcessGraphService {
    /*@ngInject*/
    constructor() {}

    build(processes, highlight) {
        let sample2InputProcesses = {};
        let sample2OutputProcesses = {};
        let highlightedProcesses = ProcessGraphService.buildHighlightedProcesses(highlight);

        processes.forEach(p => {
            p.input_samples.forEach(s => {
                let id = `${s.id}/${s.property_set_id}`;
                if (!(id in sample2InputProcesses)) {
                    sample2InputProcesses[id] = [];
                }
                sample2InputProcesses[id].push(p);
            });

            p.output_samples.forEach(s => {
                let id = `${s.id}/${s.property_set_id}`;
                if (!(id in sample2OutputProcesses)) {
                    sample2OutputProcesses[id] = [];
                }
                sample2OutputProcesses[id].push(p);
            })<commit_msg>Add methods for creating individual process nodes and edges for cytoscape<commit_after>class ProcessGraphService {
    /*@ngInject*/
    constructor() {
    }

    createProcessNode(process) {
        return {
            data: {
                id: process.id,
                name: process.name,
                details: process,
                color: ProcessGraphService.processColor(process),
                shape: ProcessGraphService.processShape(process),
                highlight: ProcessGraphService.highlightColor(process, [])
            }
        };
    }

    createEdge(sourceProcessId, targetProcessId, edgeName) {
        return {
            data: {
                id: `${targetProcessId}_${sourceProcessId}`,
                source: sourceProcessId,
                target: targetProcessId,
                name: edgeName
            }
        };
    }

    createConnectingEdges(targetProcess, processes) {
        let sample2InputProcesses = {},
            edges = [];
        targetProcess.input_samples.forEach(s => {
            let id = `${s.id}/${s.property_set_id}`;
            if (!(id in sample2InputProcesses)) {
                sample2InputProcesses[id] = [];
            }
            sample2InputProcesses[id].push(targetProcess);
        });
        processes.filter(p => p.does_transform).forEach(p => {
            p.output_samples.forEach(s => {
                let id = `${s.id}/${s.property_set_id}`;
                let processes = sample2InputProcesses[id];
                if (processes && processes.length) {
                    processes.forEach(proc => {
                        edges.push({
                            data: {
                                id: `${proc.id}_${p.id}`,
                                source: p.id,
                                target: proc.id,
                                name: s.name
                            }
                        });
                    });
                }
            });
        });

        return edges;
    }

    build(processes, highlight) {
        let sample2InputProcesses = {};
        let sample2OutputProcesses = {};
        let highlightedProcesses = ProcessGraphService.buildHighlightedProcesses(highlight);

        processes.forEach(p => {
            p.input_samples.forEach(s => {
                let id = `${s.id}/${s.property_set_id}`;
                if (!(id in sample2InputProcesses)) {
                    sample2InputProcesses[id] = [];
                }
                sample2InputProcesses[id].push(p);
            });

            p.output_samples.forEach(s => {
                let id = `${s.id}/${s.property_set_id}`;
                if (!(id in sample2OutputProcesses)) {
                    sample2OutputProcesses[id] = [];
                }
                sample2OutputProcesses[id].push(p);
            })
{'fraction_non_alphanumeric': 0.11448968799576943, 'fraction_numerical': 0.005552617662612375, 'mean_word_length': 1.3882575757575757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2562944', 'n_tokens_mistral': 991, 'n_tokens_neox': 951, 'n_words': 146}