Random processes of linear segments and graphs