<commit_before>import {
  GET_SKILLS,
} from 'Constants/actionTypes';
import { handleAction } from 'redux-actions';

const defaultState = {
  nodes: [],
  edges: [],
};

/**
 * generates the network of nodes and edges,
 * ready to be used in vis.network to avoid unessesary
 * extra parsing/iteration inside the component
 *
 * @param {integer} parentId id of the parent node
 * @param {integer} level zero based level of node in hierarchy
 * @param {object} field the field retrieved from contentful
 * @param {array} nodes the array of nodes
 * @param {array} edges the array of edges
 */
const generateNetwork = (parentId, level, field, nodes, edges) => {
  // add this skill
  const id = nodes.length + 1;
  nodes.push({
    id,
    label: field.name,
    level,
    hidden: level > 1,
  });
  if (parentId) {
    edges.push({
      from: parentId,
      to: id,<commit_msg>feat(src/reducers/skills.js): modify to work with D3 simulation<commit_after>import {
  GET_SKILLS,
} from 'Constants/actionTypes';
import { handleAction } from 'redux-actions';

const defaultState = {
  nodes: [],
  edges: [],
};

/**
 * generates the network of nodes and edges,
 * ready to be used in vis.network to avoid unessesary
 * extra parsing/iteration inside the component
 *
 * @param {integer} parentId id of the parent node
 * @param {integer} level zero based level of node in hierarchy
 * @param {object} field the field retrieved from contentful
 * @param {array} nodes the array of nodes
 * @param {array} edges the array of edges
 */
const generateNetwork = (parentId, level, field, nodes, edges) => {
  // add this skill
  const id = nodes.length;
  nodes.push({
    id,
    label: field.name,
    level,
    hidden: level > 1,
    expanded: level < 1,
  });
  if (parentId !== null) {
    edges.push({
      from: parentId,
      to: id,
      source: nodes[parentId],
      target: nodes[id],
{'fraction_non_alphanumeric': 0.11575052854122622, 'fraction_numerical': 0.002642706131078224, 'mean_word_length': 3.3219178082191783, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '775119', 'n_tokens_mistral': 583, 'n_tokens_neox': 572, 'n_words': 216}