This is always a trade-off.
As a beginning programmer, you should ask yourself two questions when considering reusing code vs. reinventing the square wheel:
- Will I learn more about the problem I want to solve by writing everything from scratch, or by focusing on the problem domain and putting aside complexity not critical to the problem that I am interested in?
- Is it more important to me to solve the problem at hand or is it more important that I understand some fundamental concepts?
If you don't have to finish your project, it's fine to spin your wheels on complex problems that other people have already solved, because you'll learn something. But you'll probably move on to something else before you "finish," which may or may not matter to you. Other projects will start to look shiny fast when you get in over your head on a complex domain that looks simple until you start trying to solve it yourself.
Don't obsess about giving up control because you're deferring to someone else's way of thinking; focus more on what you're trying to accomplish.
If your goal is to write an HTML parser because you want to understand how parsers work, go for it. If your goal is to write an HTML parser because you want to sanitize user input or transform some random bits of HTML, you're probably focused on the wrong thing, because you probably are more interested in the application of parsing rather than the parsing itself.
If you feel like writing an HTML parser because you don't want to take time to understand someone else's library, you're probably wasting your time, because, at least in this case, I guarantee someone else has spent more time figuring out how to solve this problem effectively than you'll have. In really trivial cases, you may save time by not reusing code, but in complex ones, unless the library you use sucks or your ability to read documentation and code samples sucks, you'll just waste time.
On the other hand, I would say that it's worth writing your own graph library, since you'll be more focused on transferable, fundamental algorithms and data structures that you'll be able to apply to other domains, even if you end up using someone else's library when you work on those problems.